memmove function moves string
Syntax
C memmove function has the following syntax.
void *memmove(void *to, const void *from, size_t count);
Header
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.