ProgrammingHardTCS NQT · Infosys

int a[] = {5, 1, 4}; int *p = a; *p++ += 10; printf("%d %d", a[0], *p); prints what?

  1. A. 5 11
  2. B. 15 4
  3. C. 15 1
  4. D. 5 1

Correct answer: C. 15 1

*p++ applies to the old pointer value: the element a[0] gains 10 and becomes 15, then p advances to a[1], which holds 1.

More C Programming questions

Exams that ask this topic