Computer Science, asked by nirajmarandi9636, 11 months ago

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 Anonymous
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 qwmbappe
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] = 150 +4[(a-0)*10 + (3-0)]

= 150 + 4[10a +3],

= 150 + 40a +12,

= 162 + 40a,

Hence, the address of element a[a][3] is 162 +40a.

Similar questions