Write your own memcpy() function in C
Function prototype:
myMemCpy(void* target, void* source, size_t n);
It will copy n bytes of the source to target.
Function definition:
//memcpy() Implementation, name: myMemCpy()
void myMemCpy(void* target, void* source, size_t n){
int i;
//declare string and type casting
char *t = (char*)target;
char *s = (char*)source;
//copying "n" bytes of source to target
for(i=0;i<n;i++)
t[i]=s[i];
}
Example 1) Copying a string to another (all bytes of a string to another)
Output