Mega Code Archive

 
Categories / C / Code Snippets
 

Copies count characters from from into to

//Declaration: void *memcpy(void *to, const void *from, size_t count); //Return: returns *to. #include <stdio.h> #include <string.h> #define SIZE 80 int main(void) { char b1[SIZE], b2[SIZE]; strcpy(b1, "When, in the course of..."); memcpy(b2, b1, SIZE); printf(b2); return 0; } /* When, in the course of...*/