Struct copying issue

 

Hello, can struct containing string type can be copied somehow, ex can I reserve part memory for it (limit string as 20 chars?). I understand string is 'dynamic variable', and as dynamic array and that's why cannot be copied...

  Thanks

 
You can copy just simple structures:
Structures that do not contain strings or objects of dynamic arrays are called simple structures; variables of such structures can be freely copied to each other, even if they are different structures. Variables of simple structures, as well as their array can be passed as parameters to functions imported from DLL.

Reason: