Memove c – memmove C Library Function

Memove c: The function void *memmove ( void *destination, const void *source, size_t n); copies first n bytes from memory location pointed by source to memory location pointed by destination. It does the binary copy of the data. We can copy overlapping source and destination memory locations using memmove function. It always copies exactly num bytes without checking for terminating null character(‘\0’) in source.

Function prototype of memmove

void *memmove ( void *destination, const void *source, size_t n);
  • destination : This is pointer to the memory location where the content is to be copied, type-casted to a pointer of type void*.
  • source : This is pointer to the memory location from where data to be copied, type-casted to a pointer of type const void*.
  • n : This is the number of bytes to copied.

Return value of memmove

It returns a pointer to destination memory location.

C program using memmove function

The following program shows the use of memmove function to copy data from one string to another.

memmove C Library Function

#include <stdio.h>
#include <string.h>
#include <conio.h>
int main()
   char source[100], destination[100];
   printf("Enter source string\n");
   memmove(destination, source, strlen(source)+1);
   printf("Destination string : %s\n", destination);


Enter source string
Destination string : TechCrashCourse