Hi ,
when i run the program i got the same out put by using memcpy and memmove
but i dont understand the difference between them.
manual page says that memory area should not overlap in memcpy but can in memmove.
what is meant by moving memory and how its safe . why memcpy is dangerous.
int main() {
char strmc[]="strings are good";
char strmm[]="strings are good";
printf("before memcyp : the string <%s> \n", strmc);
memcpy(strmc+1,strmc+0,4);
printf("after memcpy the string <%s> \n",strmc);
printf("before memmove : the string <%s> \n", strmm);
memmove(strmm+1,strmm+0,4);
printf("after memmove the string <%s> \n",strmm);
return 0;
}
the out put what i got is :
before memcyp : the string <strings are good>
after memcpy the string <sstrigs are good>
before memmove : the string <strings are good>
after memmove the string <sstrigs are good>