PAUSE
ENCORE5
ENCORE
BOX
ILLUSTRATION
GO
Let's assume, that we have a structure definition ...
typedef struct {
char name[2][15];
int value;
} id_tag;
which can be represented physically as shown above:
123456789012345
name
value
And a union definition:
union uni_tag {
char new_char;
int sequence;
id_tag user;
};
Each of the union elements may be physically represented as above:
123456789012345
new_char;
sequence;
user;
union uni_tag {
char new_char;
int sequence;
id_tag user;
};
Note, that the union may hold only one of its elements at a time:
123456789012345
new_char;
sequence;
user;
Therefore, the size of the union is the size of its LARGEST ELEMENT!!!!