As already pointed out in other answers, memmove
is more sophisticated than memcpy
such that it accounts for memory overlaps. The result of memmove is defined as if the src
was copied into a buffer and then buffer copied into dst
. This does NOT mean that the actual implementation uses any buffer, but probably does some pointer arithmetic.