ProgrammingVery hard

char s[] = "abc"; printf("%c", s[sizeof s - 1]); What is printed?

  1. A. \0 (prints nothing visible)
  2. B. c
  3. C. b
  4. D. d

Correct answer: A. \0 (prints nothing visible)

sizeof s is 4, so the index 3 is the terminator. Printing it with %c emits a NUL byte, which is not a visible character.

More C Programming questions

Exams that ask this topic