ProgrammingHard

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

  1. A. XbcXbc
  2. B. abcXbc
  3. C. abcabc
  4. D. XbcAbc

Correct answer: B. abcXbc

t is a separate array, so changing t[0] does not affect s. The two strings are printed one after the other.

More C Programming questions

Exams that ask this topic