[] Struct structure
type definitions: a series of data having the same data type and data of different data types set composed.
Type Definition Format:
struct worker
{
char name[10];
int age;
float salary;
struct worker *next;
};
[Warning]: structure of its member variables allocated memory sum, where each member of allocated storage space are sequentially described.
[Warning]: +1 address pointer variable depending on the structure of this memory space of the structure
Initialization: struct worker hanmeimei = { "hanmeimei ", 25,100};
pointer structure : struct worker Man; workerMan struct = * & worker Man; structure type structure pointer to the starting position.
Access members : a structure variable member name; product structure variable pointer -> member name; (* structure pointer variable) member name.
Structured array : struct worker Workers [20 is]; Workers [0] = { "Hanmeimei" , 15,80}; workers [0] .age;
structure pointer type parameters: the argument is a structure or a structure pointer variable itself variable parameter is the same type of structure pointer type variables, the basic data may be a return value type can also be a structure type. Structure can be defined in C ++ function.
[Union] Commonwealth
Type Definition: composed of several different types of variables stored in the same address beginning of a section of memory space inside. Called union.
Type Definition Format: union union name {char name [20]; int age; float salary};
type variables definitions: definition of direct and indirect definition of
[] is different from the structure: Different ways of occupying memory space. Each member has a structure separate space, memory space is equal to the size of the structure members and the size of the memory, union members share the same address opening
start memory space, depending on the maximum length of the total length of the individual members, in a the moment can only store data for each member. Only one member of either instant valid, invalid other members.
[Access] members
of the Commonwealth member variable name; the Commonwealth pointer variable -> Member Name;.
[Warning: In the Commonwealth of variables, when a new member is assigned, the original members of the duplicate address memory segment is covered, also washed away. Union type structure can be nested type definitions.
Commonwealth variable can not function as a parameter: To determine the parameter type syntax checking at compile time, but the same address its variable address consortium members do, can not determine the parameter type. But points consortium variable Union type pointer-type variables can be adopted as a function of the number, type union function may return a pointer variable.
Action: Commonwealth often used for data type conversion, because it is accessible by two or more members of the data federation method includes the Chamber. Thus in the preparation of the software system, different types of data to be processed, or requires a different bytes (8 or 16) participated in operation, often consortium manner.
[] Enumerated type enum
Definition: a collection of plastic constant name. The default is initially 0
format definition: enum {enumeration element enumeration name 1 [= 1], 2 enumeration element [= 2]}; element with a comma, the last element behind without comma.
[Warning]: where each element is an integer value. If there is no assignment when defining assignment compiler Anding Yi order 0,1,2,3 ... is its value as a reference element of the left front began to copy if it has been assigned; enumeration is considered constant, in addition to the enumeration type definition, they are not able to assign it a value. In the definition of each enumeration element must be unique, but also elsewhere in the program identifier must be unique element of the enumeration. m_enum enum { M_A, // 0 M_B, //. 1 M_C = 10, // 10 M_d by // based on a previous +1 = 11
};
[] Defined type typedef
typedef existing data type new data type names
typedef int array [10]; even after the array represents an array type shaping element 10