10. Consider a two-dimensional array Marks[10][5] having its base address as 2000 and the
number of
bytes per element of the array is 2. Now, compute the address of the element, Marks[8][5],
assuming that the elements are stored in row major order.
The adress of Marks[i][j] element of Marks[m][n] array:
Marks[i][j] adress = base adress+ size* (i*n + j-1)
Marks[8][5] adress = 2000+2* (8*5+4) = 2088
(j-1 because you want to get the beggining adress of the element)
// a typo on the 2nd line: n instead of m
Comments
Leave a comment