1.

Which of the following is the right syntax to copy n characters from the object pointed to by s2 into the object pointed to by s1?(a) void *memcpy(void *s1,const void *s2,size_t n);(b) void *memcpy(void*s2, const void *s1, size_t n);(c) void memcpy(void*s1,const void *s2, size_t n);(d) void memcpy(void *s2,const void *s1,size_t n);This question was posed to me during an interview.Query is from String Operations topic in section String Operations in C of C

Answer»

The correct ANSWER is (a) void *memcpy(void *s1,const void *s2,size_t N);

The explanation: The memcpy() function COPIES n CHARACTERS from the object pointed to by s2 into the object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.



Discussion

No Comment Found

Related InterviewSolutions