If it's higher, move from the front. If it's lower, start at the back. You have to check each time you do it.
Still doesn't work going end to start.
src starts at 50, ends at 100
dst starts at 25, ends at 75.
First we copy 100 to 75, then 99 to 74, etc ... now we get to copy from 75 to 50, but we've overwritten it already!Linux isn't Unix, so are you sure it's the same?
memmove() is in ANSI C standard.
> The memory areas may overlap: copying takes place as though the bytes in src are first copied into a temporary array that does not overlap src or dest, and the bytes are then copied from the temporary array to dest.
http://www.kernel.org/doc/man-pages/online/pages/man3/memmov...
Notice how it says 'as though'; I can't see why doing the copy backwards (from end to start) wouldn't work, myself.