Unions
union label {
int x;
char y;
};
It is similar to a struct
1 in spirit but difference is that, all the members share same overlapping memory.
The size of the union
is determined by the size of the largest member it contains.
The union
shown above has size of 4 bytes
.