Memcpy in c for array. Both do the same, but the latter works even if the source and destination overlap. If I have int* arr = new int[5]; int* newarr = new int[6]; and I want to copy the elements in arr into newarr using memcopy, memcpy(. void * memcpy ( void * destination, const void * source, size_t num ); When you pass in mainbuf, you are passing the same destination address each time. If the destination overlaps after the source, this means some addresses will be overwritten before copied. If I have int* arr = new int[5]; int* newarr = new int[6]; and I want to copy the elements in arr into newarr using memcopy, memcpy( Jun 14, 2012 ยท memcpy works on the byte level, but integers are a series of bytes. This means that memmove might be very slightly slower than memcpy, as it cannot make the same assumptions. Traditionally, the size of the source buffer has been used. If you want to use memcpy, your code will need to be a little more complex. My questions are: 1. h. ijpkzc agjmr wmwq dtzspewd vdwl yywozb uwn cohnhqh ydytr hsqfs