ProgrammingHard

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

  1. A. 7
  2. B. 6
  3. C. 8
  4. D. 11

Correct answer: A. 7

With int a[3][4] stored in row-major order, the element at flat index 7 is a[1][3], and that holds 1 * 4 + 3 = 7.

More C Programming questions

Exams that ask this topic