Array address calculation 2013

A square matrix M[][] of size 10 is stored in the memory with each element requiring 4 bytes of storage. If the base address is M[0][0] is 1840, determine the address at M[4][8] when the matrix is stored in Row Major wise

Given
B=1840, lr=0, lc=0 W=4, rows =10, column = 10, i=4, j=8
M[i][j] =B + W(i-Lr) * column +(j-Lc)]

M[4][8] = 1840 + 4[(4-0) * 10 +(8-0)]
1840 + 192
2032

This entry was posted in address. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *