memmove function moves string

Syntax

C memmove function has the following syntax.

void *memmove(void *to, const void *from, size_t count);

C memmove function is from header file string.h.

Description

C memmove function moves count characters from *from into *to and returns *to.

Example

Use C memmove function to move a string.


#include <stdio.h>//from  w  w  w .  j a  v  a2s .  c  om
#include <string.h>

#define SIZE 80

int main(void)
{
  char str[SIZE], *p;

  strcpy(str, "AAAAAAAAAAAAAAAAAAAAAAAAA");
  p = str + 10;

  memmove(str, p, SIZE);
  printf("result after shift: %s", str);

  return 0;
}

The code above generates the following result.





















Home »
  C Language »
    Function Reference »




assert.h
ctype.h
math.h
setjmp.h
signal.h
stdio.h
stdlib.h
string.h
time.h
wctype.h