A struct struct:
struct Name {
Type var1;
Type var2;
....
} ;
A data structure that combines several basic types of structures to form.
Initialization method:
struct name var_name = {Value_list};
Two common body Union:
Union name {
Type var1;
Type var2;
....
};
All data structure types in a common body use the same address, which is typically combined with structs.
struct Name {
Type var1;
Type var2;
Union {
Type VAR3;
Type VAR4;
};
};
This creates an anonymous consortium.
Three enum types:
Enum name {var_list};
The first variable in the enumeration type is assigned a value of 0, and the subsequent value of the variable is added in turn
Other implementations of the four array types:
Apart from the traditional method of declaring arrays in C, there are two other ways in C + + that have the same effect.
(1) Use <vector> header file
vector<typename> vt (n_elem) ; 如果说 size为0 , 那么后面的小括号部分可以抛弃。(2) 使用<array> 头文件 array<typename,n_elem> ai = { value_list }; 其中的array可以在两者之间直接赋值,即 array_a = array_b ;
C + + composite data structure types