ProgrammingModerate

int n = 4; int m[n][n]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) m[i][j] = i + j; printf("%d", m[3][3]); What is printed?

  1. A. 6
  2. B. 9
  3. C. 4
  4. D. 15

Correct answer: A. 6

m[i][j] = i + j, so m[3][3] = 3 + 3 = 6 (index 3 is the last row and column of a 4 x 4 array). 9 multiplies the indices, 4 treats them as 1-based (2 + 2), and 15 is the flat position 3 * 4 + 3 rather than the stored value.

More C Programming questions

Exams that ask this topic