ProgrammingModerate

char s[5] = "abcd"; printf("%s", s + 2); What is printed?

  1. A. cd
  2. B. abcd
  3. C. c
  4. D. ab

Correct answer: A. cd

s + 2 points at the third character, so printing starts at 'c'. The terminator is set by the array size, and the string is still terminated.

More C Programming questions

Exams that ask this topic