首页 > 学院 > 开发设计 > 正文

typedef与结构结合使用

2019-11-06 06:42:30
字体:
来源:转载
供稿:网友
typedef struct MyBox{ int length; int width; int hight;}box;

这语句实际上完成两个操作: 1) 定义一个新的结构类型

struct MyBox{ int length; int width; int hight;};

2) typedef为这个新的结构起了一个名字,叫box typedef struct MyBox box;

因此,box实际上相当于struct MyBox,我们可以使用MyStruct varName来定义变量


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表