ProgrammingHard

int m[2][3] = {{1, 2, 3}, {4, 5, 6}}; int *p = m[1]; printf("%d %d", p[0], *(p + 2)); What is printed?

  1. A. 1 3
  2. B. 4 5
  3. C. 5 6
  4. D. 4 6

Correct answer: D. 4 6

m[1] decays to a pointer to its first element, which is 4. Adding 2 reaches the third element of the second row, 6.

More C Programming questions

Exams that ask this topic