+ 1

What is memcpy() in c?

5th Feb 2018, 4:35 PM
aravind
2 Answers
+ 9
It makes a memory copy. It has no problem overwriting everything, if used wrong. struct t {int a, b;} org = {6, 7}, cpy; memcpy(&cpy, &org, sizeof(struct t)); cpy.a now has 6 and cpy.b has 7.
5th Feb 2018, 7:23 PM
John Wells
John Wells - avatar