B
benn686
I have a structure that contains a union that Id like to initialize at
compile time... something like:
//global declare and initialize
fullStructType var1 = { unionMember.union1.field1 = 100;
unionMember.union1.field2 = 200 };
fullStructType var2[2] = { { unionMember.union2 = 300 } ,
{ unionMember.union2 = 400 } };
where the structures are defined as :
typedef struct
{
union
{
fieldStructType union1;
alt_u16 union2;
} unionMember;
} fullStructType;
and
typedef struct{
alt_u8 field1;
alt_u8 field2;
} fieldStructType;
I get a bunch of errors on the variable declarations.. whats the
proper syntax??
Thanks!
compile time... something like:
//global declare and initialize
fullStructType var1 = { unionMember.union1.field1 = 100;
unionMember.union1.field2 = 200 };
fullStructType var2[2] = { { unionMember.union2 = 300 } ,
{ unionMember.union2 = 400 } };
where the structures are defined as :
typedef struct
{
union
{
fieldStructType union1;
alt_u16 union2;
} unionMember;
} fullStructType;
and
typedef struct{
alt_u8 field1;
alt_u8 field2;
} fieldStructType;
I get a bunch of errors on the variable declarations.. whats the
proper syntax??
Thanks!