ProgrammingModerateProduct-company MCQ pattern

What is printed?

What is printed?
int a[2][3] = {{1, 2, 3}, {4, 5, 6}};
printf("%d %d %d", *(*(a + 1) + 2), *(a[1] + 1), **a + 1);
  1. A. 6 5 2
  2. B. 6 5 4
  3. C. 3 5 2
  4. D. 5 6 2

Correct answer: A. 6 5 2

a + 1 points to row 1, *(a + 1) is that row (decays to &a[1][0]), + 2 then * gives a[1][2] = 6. a[1] + 1 → a[1][1] = 5. **a is a[0][0] = 1, and + 1 applies after dereferencing → 2 (not a[0][1] or a[1][0]).

More C Programming questions

Exams that ask this topic