下面结构体的定义语句中,错误的是
A)struct ord {int x;int y;int z;}; struct ord a;
B)struct ord {int x;int y;int z;} struct ord a;
C)struct ord {int x;int y;int z;} a;
D)struct {int x;int y;int z;} a;
自我分析是B ,因为是在定义时就声明,所以不用加struct ord
下面结构体的定义语句中,错误的是
A)struct ord {int x;int y;int z;}; struct ord a;
B)struct ord {int x;int y;int z;} struct ord a;
C)struct ord {int x;int y;int z;} a;
D)struct {int x;int y;int z;} a;
自我分析是B ,因为是在定义时就声明,所以不用加struct ord
你分析的没错。
1 声明完就定义个变量,没有问题
2 声明语句没有结束,就定义变量,有错误。
3 声明语句后跟一个id,就是用这个类型定义一个变量。
4 struct 没有名字,定义了一个此类型的变量,语法允许。