现在的位置: 首页 > 综合 > 正文

c与c++中enum,struct,union主意点

2013年10月05日 ⁄ 综合 ⁄ 共 215字 ⁄ 字号 评论关闭
enum boolen{FALSE, TURE};

在c中定义枚举类型是必须是

enum boolen isRight

在c++中定义枚举类型

enum boolen isRight;
或
boolen isRight;

2.枚举类型相当于unsigned,对枚举类型进行sizeof操作不管是对类型名还是对枚举成员,其sizeof后的值都相当与sizeof(unsigned),为4。

3.struct与union也同enum一样,但sizeof操作不一样。

抱歉!评论已关闭.