C语言struct结构体的几种定义方式

struct属于结构体类型,有如下几种定义:

1struct

{

//成员名

}变量名;

2.sturct 类型名

{

/成员名

};

3.typedef是定义别名

typedef struct

{

//成员

}别名;

4.typedef struct 结构体类型名

{

//成员

}别名;

5. struct 类型名

{

}变量名;

6.typedef struct 结构体类型名

{

//成员

};此时无结构体别名。

猜你喜欢

转载自www.cnblogs.com/pquan/p/12816762.html