当前位置:神舟问>百科知识>typedef struct 是什么意思

typedef struct 是什么意思

2024-01-30 15:04:35 编辑:join 浏览量:612

问题补充说明:typedef用于定义一种新类型例如定义了如下的结构typedef struct student{int age;int score;}STUDENT;那么则有STUDENT stu1;就相当于struct student stu1;上面的结构也可以直接定义为:typedef struct {int age;int score;}STUDENT;然后将STUDENT作为新类型使用,比如STUDENT stu1; 在百度上授的,可我还是不知道他的意思麻烦人家帮我看以下

typedef struct 是什么意思

type来自def声明新的类型来代360问答替已有的类型的名字。

如:

typedefintINTE执维力顶小记打跳GER;

下面两行等价

inti;

INTEGERi;

可以声明结构体类型:

typedefstruct

{

intage;

intscore;

}STUDEN探有板怎很导松钱久边T;

定义变量:

只能写成STUDENTstu;

如果来写成

typedefstructstudent

{

intage;

intscore;

}STUDENT;

下面三行等价:

STUDENTstu;

structstudentstu;

studentstu;

大概意思就是上面的,不太明白hi我。

标签:typedef,struct

版权声明:文章由 神舟问 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.shenzhouwen.com/article/268350.html
热门文章