memcpy() is generally used to copy a portion of memory chuck from one location to another location.
memcpy() works fine when there is no overlapping between source and destination. Lets consider a overlapping of buffer in the front side/lower side. Below picture shows the details.
Here result is not expected. From the above graphical view it is clear that some mechanism should be there to take care of the overlapping and displacement of elements should be in the reverse direction when overlapping is at the trailing side. Below diagram shows how it should be.