9.A two dimensional array a[5][10] is stored in the memory using row major order .Calculate the address of the element a[a][3].If the base address is 150 and each element requires 4 bytes of memory space.
Answers
Answered by
5
Explanation:
two dimensional array a[5][10] is stored in the memory using row major order .Calculate the address of the element a[a][3].If the base address is 150 and each element requires 4 bytes of memory space.
Answered by
0
Given,
Two-dimensional array - a[5][10],
element - a[a][3],
Base address - 150,
size of element - 4 bytes,
To Find,
Address of element a[a][3],
Solution,
Now formula of row major column is,
Address of a[i][j] = Base address + (Size of byte)*[(I-LR)*N + (J-LC)]
Here,
I = row subset whose address is to be found,
J = Column subset whose address is to be found,
LR = Lower limit of row,
LC = Lower limit of column,
N = number of column given,
Address of a[a][3] =
= ,
=
= 162 + 40a,
Hence, the address of element a[a][3] is .
Similar questions