1.定义了结构体类型Student(typedef struct student),声明变量时直接可以用Student stu2;
反之用struct student定义则声明变量时就必须这样:struct Student stu2;
(所以它们还有什么区别以及作用呢?)
2.在c++中可以不需要typedef就可以Student stu2是因为在c++中struct也是一种类,
所以可以直接使用Student stu2来定义一个Student的对象,但c中去不可以。
1.定义了结构体类型Student(typedef struct student),声明变量时直接可以用Student stu2;
反之用struct student定义则声明变量时就必须这样:struct Student stu2;
(所以它们还有什么区别以及作用呢?)
2.在c++中可以不需要typedef就可以Student stu2是因为在c++中struct也是一种类,
所以可以直接使用Student stu2来定义一个Student的对象,但c中去不可以。