A union is like a struct in that it generally has several fields, all of which are public by default. Unlike a struct, however, only one of the fields is used at any given time. In other words, it is a structure that allows the same storage space to be used to store values of different data types at different times.
Read moreWhich is better to use union or struct?
If you want to use same memory location for two or more members, union is the best for that . Unions are similar to the structure. Union variables are created in same manner as structure variables.
Read more