C Functions Question:

Download Job Interview Questions and Answers PDF

Can you please explain the difference between strcpy() and memcpy() function?

C Functions Interview Question
C Functions Interview Question

Answer:

► Memcpy() copies specific number of bytes from source to destinatio in RAM, where as strcpy() copies a constant / string into another string.
► Memcpy() works on fixed length of arbitrary data, where as strcpy() works on null-terminated strings and it has no length limitations.
► Memcpy() is used to copy the exact amount of data, whereas strcpy() is used of copy variable-length null terminated strings.

Download C Functions Interview Questions And Answers PDF

Previous QuestionNext Question
What is memcpy() function?What is exit() function?