ProgrammingModerate

Row-major storage of int a[4][5] means a[i][j] is at flat index i * 5 + j. What flat index holds a[3][2]?

  1. A. 16
  2. B. 18
  3. C. 13
  4. D. 17

Correct answer: D. 17

3 * 5 + 2 = 17. Using 4 as the row length (the first dimension) would give 14 instead, which is the common mistake.

More C Programming questions

Exams that ask this topic