What is the difference between memmove and memcpy? Which one do you usually use and how?
memmove can handle overlapping memory, memcpy can't.
Consider
char[] str = "foo-bar";
memcpy(&str[3],&str[4],4); //might blow up
Obviously the source and destination now overlap, we're overwriting
"-bar" with "bar". It's undefined behavior using memcpy if the source
and destination overlap so in this case cases we need memmove.
memmove(&str[3],&str[4],4); //fine