C语言Review2_struct

typedef struct Student
{
int a;
}Stu;
//Stu是 struct Student的别名;使用typedef为struct Student取个别名;
如果没有使用typedef的话,声明变量就需要完整的写法 struct Student stu1;
声明变量时为了方便,没有人愿意多写struct这个关键字;

还有一个写法是不写Student;直接:
typdef struct
{
int a;
}Stu;
//这样有个问题就是,声明变量的时候不能struct Student stu1了;

在C++里面很简单:
struct Student
{
int a;
};
//这样就定义了结构体类型Student,声明变量时直接Student stu2;

原文地址:https://www.cnblogs.com/grooovvve/p/13882033.html