[Simple] "Union" and "Structure" have some similarities. 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. 1. Union definitions define a general form of a joint type: UNION Joint Name {member table}; member table contains several members, the general form of members: Type indicator member name member name should meet the identifier . For example: Union Perdata {Int Class; Char Office [10];}; Second, the combined variable describes the description of the combined variables and structural variables. There are also three forms. That is, first defined, then explain; definitions simultaneously explain and directly explain. Take the PERDATA type as an example, explain as follows: Union Perdata {Int Class; Char OffICAE [10];}; Union PerData A, B; / * Description A, B is PerData type * / or can be described at the same time as: union perdata {int Class; char office [10];} a, b; or direct description is: union {int class; char office [10];} A, B variables are PerData types. Their memory assignment is shown in Figure 7-8. A, the length of the B variable should be equal to the longest length in the members of PerData, which is equal to the length of the Office array, a total of 10 bytes. As can be seen from the figure, if the B variables are given to the integer value, only two bytes are used, and 10 bytes can be used when applying the character array. The assignment of the combined variable and the assignment of the combined variable can only be done with a member of the variable. Members of the combined variable are represented as: a combined variable name. Member name, for example, a variable that is illustrated as a PerData type, can use A.CLASS A.Office not allow only combined variable name to assign values or other operations. The initialization assignment of the combined variable is also not allowed to assign only in the program. Also emphasized that a combined variable can only give a member value each time. In other words, the value of a combined variable is a member value of a joint committee. [Example 7.15] There is a form of teacher and student, and teachers have four names, age, occupations, and teaching and research. The students have four names, age, occupation, and class. Program input person data, then output it in a table.