结构体的一些形式理解

来源:互联网 发布:淘宝客6月1号起 编辑:程序博客网 时间:2024/04/28 13:09
//1、struct book {int a;int b;char c;};//结构声明struct book library;//结构变量定义//上述等价于struct book {int a;int b;char c;} library;//2、struct {int a;int b;char c;} library;//不带标记//3、typedef struct complex {float real;float imag;} COMPLEX;//可以用COMPLEX来替代 struct complextypedef struct {float real;float imag;} COMPLEX;//省去了结构标志complex,此时COMPLEX代替 struct {float real;float imag;}/*实际定义结构体时,可以这样写: struct complex library; complex library; COMPLEX library; */

0 0