Top

Discussion

What will be the output of the following C code?

const char pla[] = "string1";
const char src[] = "string2";
printf("Before memmove place= %s, src = %s\n", pla, src);
memmove(pla, src, 7);
printf("After memmove place = %s, src = %s\n", pla, src);

 

  • A.Before memmove place= string1, src = string2 After memmove place = string2, src = string2
  • B.Before memmove place = string2, src = string2 After memmove place= string1, src = string2
  • C.Before memmove place = string2, src = string1 After memmove place= string2, src =string2
  • D.Before memmove place= string1, src = string2 After memmove place=string1, src = string1

Answer: A

In the C library function void *memmove(void *str1, const void *str2, size_t n) copies n characters from str2 to str1.

No comment is present. Be the first to comment.
Loading…

Post your comment