ProgrammingVery hard

char buf[7] = "hello"; memmove(buf + 1, buf, 5); printf("%s", buf); What is printed?

  1. A. hhello
  2. B. hello
  3. C. hheel
  4. D. hhell

Correct answer: A. hhello

memmove behaves as if the five source bytes were copied first, so hello lands at positions 1 to 5. The terminator at index 6 is untouched, so the string is hhello.

More C Programming questions

Exams that ask this topic