ProgrammingHard

printf("%s", strcat(strcpy(buf, "ab"), "cd")); with char buf[10] declared before the call. What is printed?

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

Correct answer: A. abcd

strcpy copies ab into buf and returns buf. strcat then appends cd to the same buffer, so the result is abcd.

More C Programming questions

Exams that ask this topic