When a variable number of instances of a structure is required, the instances are usually created in main storage obtained dynamically using the calloc or malloc functions. To initialize the fields in such structures, the following technique is recommended:
MQMD Model = {MQMD_DEFAULT}; /* declare model instance */The static or auto keywords can be coded on the declaration in order to give the model instance static or dynamic lifetime, as required.
PMQMD Instance; Instance = malloc(sizeof(MQMD)); /* get storage for dynamic instance */
memcpy(Instance,&Model,sizeof(MQMD)); /* initialize dynamic instance */
Notices |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
csqzak1031 |