Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  memcpy() vs memmove() in C

memcpy() copies the bytes of data between memory blocks. If the block of memory overlaps, the function might not work properly. Use memmove() to deal with overlapping memory blocks. memmove() is very much like memcpy() but very flexible as it handles overlapping of memory blocks. example : char msg[50] = "abcdefghijklmnopqrstuvwxyz"; char temp[50]; main() { strcpy(temp, msg); printf("Original Msg = %s\n",temp); memcpy(temp+4, temp+16, 10); printf("After memcpy without overlap = %s\n",temp); strcpy(temp , msg); memcpy(temp+6, temp+4, 1...

11,021 0       COMPARISON MEMORY MEMCPY MEMMOVE C DIFFE