The declaration of a union includes all members of the union, and lists the possible object types the union can hold. The union can hold any one member at a time-subsequent assignments of other members to the union overwrite the existing object in the same storage area. Unions can be named with any valid identifier. An empty union cannot be declared, nor can a union contain an instance of itself. A member of a union cannot have a void , function, or incomplete type.
Unions can contain pointers to unions of their type.
Another way to look at a union is as a single object that can represent objects of different types at different times. Unions let you use objects whose type and size can change as the program progresses, without using machine-dependent constructions. Some other languages call this concept a variant record . The syntax for defining unions is very similar to that for structures. Each union type definition creates a unique type.