Code area
Regarding enumerated types: the
default order starts from 0;
initialization is not allowed, but the following assignments are correct
#include<stdio.h>
main()
{
enum color{red=3,blue,yellow)a; //red=3写在外面就是错的,因为red本身就是一个常量
a=blue;
printf("%d\n",a);
}
About the common
output information; assign a value to a member; initialize
#include<stdio.h>
main()
{
typedef union student
{
int a;
char c;
float b;
}s;
s x; //定义变量
x.a=4;
x.c='a';
x.b=2.9;
printf("%d\n",x.a); //只看最后一个成员,注意输出格式
union student x={.c='j'}; //对某个成员赋初值
union student x={16}; //默认对第一个成员初始化
}