Format
#include <string.h> /* also in <memory.h> */ void *memmove(void *dest, const void *src, size_t count);
Language Level: ANSI, XPG4, Extension
memmove copies count bytes of src to dest.
memmove allows copying between objects that may overlap. The
behavior is as if the src is first copied into a
temporary array.
Return Value
memmove returns a pointer to dest.
Example
This example copies the word shiny from
position target + 2 to position target + 8.
#include <string.h> #include <stdio.h>
#define SIZE 21 char target[SIZE] = "a shiny white sphere";
int main( void )
{
char * p = target + 8; /* p points at the starting character
of the word we want to replace */
char * source = target + 2; /* start of "shiny" */
printf( "Before memmove, target is \"%s\"\n", target ); memmove( p, source, 5 ); printf( "After memmove, target becomes \"%s\"\n", target ); return 0;
/**********************************************************************
The output should be:
Before memmove, target is "a shiny white sphere"
After memmove, target becomes "a shiny shiny sphere"
**********************************************************************/
}
![]()
memccpy -- Copy Bytes
memchr -- Search Buffer
memcmp -- Compare Buffers
memcpy -- Copy Bytes
memicmp -- Compare Bytes
memset -- Set Bytes to Value
strcpy -- Copy Strings
<memory.h>
<string.h>