ProgrammingVery hard

char s[] = "ab"; char *q = s + 2; printf("%d", *q); What is printed?

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

Correct answer: D. 0

s + 2 points at the terminator of the three-byte array, which holds 0. Dereferencing it is defined.

More C Programming questions

Exams that ask this topic