December 2005
Beginner to intermediate
618 pages
20h 19m
English
memmove
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.
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.
Read now
Unlock full access