1.结构体相互嵌套使用
特性:结构体可以包含结构体指针,但绝对不能在结构体中包含结构体变量。
struct test{ float socre; test *next; }; //这样是正确的! | struct test{ float socre; test next; }; //这样是错误的! |
2.这两种定义的区别
typedef struct student { int num; struct student *next; }student; | struct student { int num; struct student *next; }; |
用typedef把struct student这个结构体类型名字重新定义为student, 也就是说struct student和student表示同一个事物,都是一个类型的标识符。 | struct student是定义了一个student结构体 |