You can use memcpy or memmove to copy the entire contents of the structure itself. However, since C has no introspection, copying objects with a pointer cannot be performed using a general purpose function.
Edited to add: as some commentators note, you can simply assign structures to other structures in C dialects that have been used for the past several decades, memcpy is no longer required.
Perry source share