Loading, please wait...

Declarations

A union is declared with keyword union in the same format as a structure.

 

The union definition

union number {

int x;

double y;

};

indicates that number is a union type with members int x and double y. The union definition is normally placed in a header and included in all source files that use the union type.