ProgrammingVery hard

int a[3]; int *p = a; printf("%d", p + 3 > a); What is printed?

  1. A. 0
  2. B. 1
  3. C. 3
  4. D. undefined behaviour

Correct answer: B. 1

p + 3 points one past the last element, which is a valid pointer value to compare. Since it is greater than a, the result is 1.

More C Programming questions

Exams that ask this topic