Name
memmove
Synopsis
Copies the contents of a memory block
#include <string.h> void *memmove
( void *dest
, const void *src
, size_t intn
);
The memmove()
function
copies n
successive bytes beginning at
the address in src
to the location
beginning at the address in dest
. The
return value is the same as the first argument,
dest
. If the source and destination
blocks overlap, copying takes place as if through a temporary
buffer, so that after the function call, each original value from
the src
block appears in
dest
.
Example
char a[30] = "That's not what I said." ;memmove
( a+7, a+11, 13 ); // Move 13 bytes, 'w' through '\0'
puts( a );
These lines produce the following output:
That's what I said.
See Also
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.