结合就是跟结构很像,区别就是结合中的数据只能唯一种存在,当给另一个赋值时,前一个数据会被丢弃!!!!!
结合
结合用关键字union定义
union password
{
unsigend long birth;
unsigend short num;
char pet;
};
也像结构一样使用;
union password psd;
psd.birth = 19840902;
psd.pet = "xiaomaomi";
但是当你在给pet赋值时,birth是被丢弃了的
枚举
枚举用关键字 enum 定义