copy byte string

View versions (3)

INTERFACE

#include <string.h>
void memmove ( void *dst, const void *src, size_t len )

DESCRIPTION

The memmove function copies &#92;c len bytes from string &#92;c src to string &#92;c dst. The two strings may overlap; the copy is always done in a non-destructive manner.

Example 1
Workings

\code #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
", i, u[i]); return 0; } \endcode

Solution

Output:

u[0] = 1
u[1] = 1
u[2] = 2
u[3] = 3
u[4] = 4
u[5] = 5

RETURN VALUES

The memmove function returns the original value of &#92;c dst.

SEE ALSO

memcpy, strcpy

STANDARDS

The memmove function conforms to ISO/IEC 9899:1990 ("ISO C90").