013-union, enumeration

013-union, enumeration

Commonwealth (Consortium):

What is a consortium?

​ Similar to a structure, but the biggest difference lies in the allocation of storage space ;
​ The purpose is to define a union when the type of the target quantity is uncertain;
​ It can save space;​​ The first name of all member variables in
the union​ Among the member variables of the union, generally only one member variable is used at the same time ;


What types can unions contain?

​ Basic data types:
​ char/short/int/long/float/double
​ Composite types:
​ Array-Integer array/character data,,,, Array of
pointers
Structure
Union (not the structure itself
) Structure Array
Pointer - Integer Pointer/Character Pointer,,,
Array Pointer/Function Pointer
Structure Pointer
Function?
​ can't

How is a union defined?
格式:
union 联合体类型名
{
   
    
    
	...

Guess you like

Origin blog.csdn.net/weixin_45073889/article/details/132101158