Union:
A union is a special data type available in C that allows to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time.
Syntax-
Union name
{
data types;
};
Differnce between structure and union:
Example
struct name
{
int a;
char ch;
};
union name1
{
int a;
char ch;
}
sizeof(name): 5
sizeof(name1): 4
Hence total size of union is equal to the size of biggest data type define in it.