"Union" has some similarities between "structure". But both have different inherent. In the structure, each member has its own memory space, the total length of a structural variable is the sum of each member length. In the "United", each member share a memory space, and a combined variable is equal to the longest length in each member. It should be noted that this so-called sharing does not mean that multiple members are simultaneously loaded into a combined variable, but means that the combined variable can be given to any member value, but only one value can be assigned each time. The value is rushed away. As the "unit" variable described earlier, if it is defined as a combination of "class" or "teaching,", it allows the intersection (class) or a string (teaching and research room). Either give an integer value, or give a string, you cannot give it simultaneously. The definition of the federal type and a combined variable describes that a joint type must be defined to explain the variable as the federated type.
First, the union definition
Define a general form of a joint type:
Union United Name {member table};
The membership table contains several members, and the general form of members is: Naming of the type indicator member name should meet the identifier.
E.g:
Union Perdata {Int Class; Char Office [10];
Define a federated type named PerData, which contains two members, one for integers, member names; another array, the array is named office. After the joint definition, a combined variable description can be performed as a variable of the PerData type, and an integer Class or a character array office can be stored.