You are here : Cstring.hmemcpy

memcpy() - string.h

The C library function void *memcpy(void *str1, const void *str2, size_t n) copies n characters from memory area str2 to memory area str1.


Syntax

void *memcpy(void *str1, const void *str2, size_t n)


Example

#include <stdio.h>
#include <string.h>

int main ()
{
   const char src[50] = "http://www.tutorialspoint.com";
   char dest[50];

   printf("Before memcpy dest = %s\n", dest);
   memcpy(dest, src, strlen(src)+1);
   printf("After memcpy dest = %s\n", dest);
   
   return(0);
}


Output / Return Value

Before memcpy dest =
After memcpy dest = http://www.tutorialspoint.com


Limitations


Alternatives / See Also


Reference