What is Memory Map of an Array in C Language ??? with Free Notes

Memory Map of an Array

Memory Map of an Array can be defined as a map by which an array can be represented inside the memory. We will study this concept in One Dimension and Two Dimension Array.

One Dimensional Array

Let us suppose that we have one dimensional array declaration as follows:

int S[5] = {10, 20, 30, 40, 50,};

Since we know that array elements are stored at contiguous memory locations, so its memory map can be shown as:

Where 2000, 2002, …. are assumed as contiguous addresses where the elements of an array S are stored. As int data type takes 2 bytes of memory to store, so the addresses are in the gap of 2 bytes each.

Free Programming E-Books

Two Dimensional Array

Let us suppose that we have two dimensional array declarationas follows:

int a[2][3] = {10, 20, 30, 40, 50};

Its memory will look like the following:

This memory map is conceptual because there are no rows and columns present in actual memory.

In actual memory all the elements are stored at contiguous memory locations.

So its memory map in actual memory will be:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top