Question 10
Back to Exercise
For int m[R][C] starting at address B, what is the address of m[i][j]?
- A B + (j × R + i) × sizeof(int)
- B B + (i × C + j) × sizeof(int) Correct
- C B + (i + j) × sizeof(int)
- D B + i × j × sizeof(int)
Correct Answer: Option B
C stores 2D arrays row by row. Before row i there are i full rows of C elements, then j more elements in row i: offset i × C + j elements.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!