A two-dimensional array A of 4-byte integers is stored in row-major order starting at address 1000, with indices starting at 0. What is the address of A?
Correct answer C. 1260
Explanation
In row-major order, whole rows are stored one after another, so address = base + (i × number of columns + j) × size. Here that is 1000 + (3 × 20 + 5) × 4 = 1000 + 65 × 4 = 1260. The value 1212 is what column-major order would give, a common slip when the storage order is misread.
Answer checked How we write and check questions
Discussion