Array address calculation 2016

A matrix A[m][n] is stored with each element requiring 4 bytes of storage. If the base address at A[1][1] is 1500 and the address at A[4][5] is 1608, determine the number of rows of the matrix when the matrix is stored in Column Major Wise.

Column Major Wise: A[i][j] =BA + W[ (j – lc) * rows + (i – lr)]
Putting the values: 1608 = 1500 + 4[ (5-1)*rows + (4-1)]
1608 = 1500 + 16 *rows + 12
-16 * rows = – 96
Row = 6

This entry was posted in address. Bookmark the permalink.

Leave a Reply

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