main()
{
union{
char i[2];
struct{
short age;
} myStruct;
} myUnion;
myUnion.i[0] = 'A';
myUnion.i[1] = 'B';
printf("%x ", myUnion.myStruct.age);
}
So I understand that the union only contains the space for the largest member inside it - in this case, the char array "i" and the struct "myStruct" seem to be the same, so the union would only have two bytes containing characters 'A' and 'B'. However, what would happen if you tried to read the struct member "age" at that point?