ProgrammingHard

A 5 x 7 int matrix is stored in row-major order. What is the flat offset of the cell at 1-based row 3, column 4?

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

Correct answer: C. 17

The 0-based indices are (2, 3), so the offset is 2 x 7 + 3 = 17. Using 1-based indices directly gives the off-by-one result 18.

More C Programming questions

Exams that ask this topic