What is the difference between the memmove() and memcpy() function?

It is one of the frequently asked interview question .

memmove(): offers guaranteed behavior if the source and destination arguments overlap. memcpy() makes no such guarantee, It’s always safer to use memmove(). Note that the prototype of memmove() is
void *memmove(void *dest, const void *src, size_t count);

memcpy() will not care if the memories overlap and will either copy from left to right or right to left without checking which method to used depending on the type of the overlap.

65 total views, 5 views today

Leave a Reply