malloced structure initilization

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Feb 11 00:09:21 AEST 1989


In article <202 at sabin.UUCP> bjm at sabin.UUCP (Brendan J. McMahon) writes:
>How do you initialize memory malloced for a structure without using calloc,
>and without initilizing each structure element explicitly?

Copy a preinitialized (static) structure onto the freshly allocated one.
In modern C this can be done with a single assignment expression.



More information about the Comp.lang.c mailing list