ProgrammingHard

char s[] = "x\0y"; printf("%s", s); What is printed?

  1. A. xy
  2. B. y
  3. C. x y
  4. D. x

Correct answer: D. x

The embedded zero ends the string for %s, so only x is printed.

More C Programming questions

Exams that ask this topic