What is memcpy() in c? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is memcpy() in c?

5th Feb 2018, 4:35 PM
aravind
1 Answer
+ 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