ProgrammingModerate

char *s = "abc"; char t[4]; strcpy(t, s); t[1] = 'X'; printf("%s", t); What is printed?

  1. A. abc
  2. B. aXc
  3. C. Xbc
  4. D. aXX

Correct answer: B. aXc

strcpy copies the four bytes of abc with its terminator into t, and t[1] is then replaced by X.

More C Programming questions

Exams that ask this topic