235 views
Explain the method to calculate the address of an element in an array. A 25*4 matrix array
DATA is stored in memory in ‘row-major order’. If base address is 200 and 4 words per
memory cell. Calculate the address of DATA [12, 3]…??

### 1 comment

each cell size =$4$ words

array size =$25*4$

Data Stored in row major order.

So we first have to cross all the element till 11th row . As each row has $4$ column so total no of element we crossed $4*12=48$   [considering array index start from 0th row so , $0$ to $11$ total $12$ rows each having $4$ elements].

Now we are at 12th row and we have to go to 3rd column 12th row so we have to $3$ element in that row .

So total number of element we crossed =$(48+3)=51$

Each element size =4 word .

So crossed =$51*4=204$

Base address =$200$

So the address of the cell array[12,3] =$200+204=404$.

ans=200+12*4*4-4+4*4

=404.