Unions
Union:When one or more different variables share the same memory location,the form a UNION.The declaration and use of union is similar to that of structure but the functioning is different.
Declaration:
union tag(name of the union)
{
type1 member1;
type2 member2;
.
.
.
typen member n;
}union variables;
Note:union is a keyword.
e.g.
union example
{
char name[30];
int roll;
int total;
}myunion;
Now,example is a datatype and myunion will be a variable of type example.Union variables can also be declared by using a separate declaration statement.
  union example myunion;
Whenever a union variable is declared the compiler will automatically allocate enough memory to hold the largest member of the union.
Members of union can be accessed in the same way as that of structures i.e using dot operator.
All the elements of union co-exists in the same memory area with the overlapping according to their sizes stated by their different types.Therefore,only one value of any one type can be stored into the union.
CACKLE comment system