Initializing complex structured arrays: HOW?
Geoff C Wing
gwing at mullauna.cs.mu.OZ.AU
Sun Jun 30 18:33:21 AEST 1991
How can one initialize an array of structures if the structure is not simple,
in this case containing a union?
/* here's the standard version: */
struct standard_struct
{
int integer1;
};
struct standard_struct standard[] = { 10, 20, 30, 40 };
/* and here's the desired version */
struct test_struct
{
union {
int integer2;
char letter2;
} hmmm;
};
struct test_struct test[] = { 10, 'a', 30, 40 };
| Geoff C Wing | \ _ _ _ _ __
|gwing at mullauna.cs.mu.oz.au | // \ |\/| | / __ /\
|gwing at munmurra.cs.mu.oz.au | \X/ /\ \ | | _|_ \__| //\\
|static at phoenix.pub.uu.oz.au|
More information about the Comp.lang.c
mailing list