I have a query about memcpy's prototype.
Since the arguments are restricted pointers and according to a restricted pointer only that pointer has access to the object how the function works? and copies the bytes from one pointer to another?
I think overlapping situation is something like :
Code:
#include<stdio.h>
int main(void)
{
char msg[60]="abcdefghijklmnopqrstuvwxyz";
char tmp[60];
strcpy(tmp , msg);
memcpy(tmp+4 , tmp+16 , 10); /* without overlap temp is : abcdqrstuvwxyzopqrstuvwxyz */
strcpy(tmp,msg);
memcpy(tmp+6, tmp+4,10); /* with overlap temp is :
abcdefefefefefefqrstuvwyz */
return 0;
}
I am confused when I see the keyword restrict in the function although I know its concept.