Search code examples
cmemmove

memmove implementation


In reference to the thread: memmove implementation in C, I did not understand why would there be a memory overlap for 2 different variables? i.e. is this a normal scenario that the compiler allocates same 'common space' to 2 different variables and why is this policy used by compilers in such cases?


Solution

  • Nothing to do with the compiler. Consider the following:

    int x[100];
    
    memmove(&x[1], &x[0], 99*sizeof(int));