ProgrammingHardTCS NQT · Infosys

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

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

Correct answer: B. 6

p + 1 points to the second row {4, 5, 6}. Dereferencing gives that row's first element, and adding 2 reaches its third element, which is 6.

More C Programming questions

Exams that ask this topic