c++ memcpy

Posted this on another forum. I thought I will try to post on this site and see if I get any responses.
Can you please explain if there is any overlap or any data is overwritten if the following two statements are executed successively. Thanks,
a)memcpy (origVal + aLen, attrid, attrLen);
b)memcpy (origVal, secattrid, aLen);

There will be no overlap

I would prob call them in the reverse order, as that makes more sense to my brain.

b) fills in aLen elems, from 0 - aLen-1

a) files in starting at elem aLen.

So no overlap.

You could code it with a couple of char arrays as standins for the ids, then print it out, to convince yourself?
Last edited on
Topic archived. No new replies allowed.