ProgrammingHard

char s[10] = "xyz"; strcpy(s + 1, "ab"); printf("%s", s); What is printed?

  1. A. xyab
  2. B. abz
  3. C. xabz
  4. D. xab

Correct answer: D. xab

strcpy writes ab and its terminator starting at index 1, so the first character x stays and the string ends after b.

More C Programming questions

Exams that ask this topic