Header file:
string.h
Synopsis:
void *memcpy(char *dest, char *source, size)
Description:
Copies the contents of the source to the destination.
Return Value:
Returns 0,on success
Sample Program:
#include <stdio.h>
int main() {
char *ptr1, *ptr2;
ptr1 = (char *)malloc(10);
ptr2 = (char *)malloc(10);
strcpy(ptr1, "jayaprakas");
memcpy(ptr2, ptr1, 10);
printf("%s", ptr2);
return 0;
}
Output:
jayaprakas
No comments:
Post a Comment