I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
ComputingCString.h

memmove

Copy byte string
+ View other versions (3)

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:
Example - Copy byte string
Workings
#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;
}
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 \c dst.

Standards

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