+1 vote
in Mathematics by kratos

An array Arr[15][20] is stored in the memory along the row with each element occupying 4 bytes of memory. Find out the Base address and address of the element Arr[3][2], if the element Arr[10][25] is stored at the address 1500.

1 Answer

+4 votes
by kratos
 
Best answer

Total no. of Rows R=15

Total no. of Columns C=20

Lowest Row lr=0

Lowest Column lc=0

Size of element W=4 bytes

Arr[I][J] i.e., Arr[5][2]=1500

Arragement Order:Row wise

Base Address B=?

=> Arr[I][J]=B+W(C(I-lr)+(J-lc))

Arr[5][2]=B+4(20(5-0)+(2-0))

1500=B+408

B=1092

Base Address=1092

Arr[3][2]=B+W(C(3-0) + (2-0))

=1092+4(20(3-0) + (2-0))

=1092 + 248

=1340

Arr[3][2] = 1340

...