New course! Every coder should learn Generative AI!
Try a free lesson+ 1
What is memcpy() in c?
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.