memmove
copy byte string
You're viewing an older version of this page (#3492). View the current version.
INTERFACE
#include <string.h> void memmove ( void *dst, const void *src, size_t len )
DESCRIPTION
The memmove function copies \c len bytes from string \c src to string \c dst. The two strings may overlap; the copy is always done in a non-destructive manner.
Example 1
#include <stdio.h>
#include <string.h>
int main()
{
// define the array u
int u[6] = {1, 2, 3, 4, 5};
// copy u to u + 1 (these arrays overlap)
memmove(u + 1, u, 5*sizeof(int));
// display u
for (int i = 0; i < 6; ++i)
printf("u[%d] = %d\n", i, u[i]);
return 0;
}Output:
u[0] = 1
u[1] = 1
u[2] = 2
u[3] = 3
u[4] = 4
u[5] = 5RETURN VALUES
The memmove function returns the original value of \c dst.
SEE ALSO
STANDARDS
The memmove function conforms to ISO/IEC 9899:1990 ("ISO C90").