typedef struct 是什么意思

来源:百度知道 编辑:UC知道 时间:2024/05/15 09:39:10
是c语言的问题

typedef用于定义一种新类型
例如
定义了如下的结构
typedef struct student
{
int age;
int score;
}STUDENT;
那么则有
STUDENT stu1;
就相当于struct student stu1;
上面的结构也可以直接定义为:
typedef struct
{
int age;
int score;
}STUDENT;
然后将STUDENT作为新类型使用,比如STUDENT stu1;