ProgrammingHard

int a[] = {4, 5, 6}; int *p = &a[2]; printf("%d", *(p - 2)); What is printed?

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

Correct answer: D. 4

p = &a[2], and p - 2 steps back two ints to a[0], so the output is 4. 6 ignores the subtraction, and 5 steps back only one element.

More C Programming questions

Exams that ask this topic