C Programming Memory Representation arrays | Multidimensional Array Memory Representation

Memory Representation of Multidimensional Array in C Language | C Programming Memory Representation  arrays | Multidimensional Array Memory Representation

 

Memory Representation
  • 2-D arrays are Stored in contiguous memory location row wise.
  • 3 X 3 Array is shown below in the first Diagram.
  • Consider 3×3 Array is stored in Contiguous memory location which starts from 4000 .
  • Array element a[0][0] will be stored at address 4000 again a[0][1] will be stored to next memory location i.e Elements stored row-wise
  • After Elements of First Row are stored in appropriate memory location , elements of next row get their corresponding mem. locations.

Basic Memory Address Calculation :

a[0][1] = a[0][0] + Size of Data Type
ElementMemory Location
a[0][0]4000
a[0][1]4002
a[0][2]4004
a[1][0]4006
a[1][1]4008
a[1][2]4010
a[2][0]4012
a[2][1]4014
a[2][2]4016

No comments:

Post a Comment