Answer to Question #345799 in C++ for Arun

Question #345799

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.

1
Expert's answer
2022-05-30T08:16:14-0400

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


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS