來自《C語言深度剖解》陳正衝老師編著(這本好書,解開了很多似懂非懂其實不懂假裝懂得問題)
1.結構體定義
typedef struct student{
//code;
}Stu_st, *Stu_pst;
2.兩種類型的等價
struct student stu1;
Stu_st stu1;
兩者等價
struct student *stu2;
Stu_pst stu2;
Stu_st *stu2;
三者定義等價。
3.解釋:
看作整體:
struct student{
//code
}
typedef 就是給上面取了別名叫“Stu_st”;
同時給
struct student{
//code
}*
取了別名叫Stu_pst;
只是兩者同時取而已
4.擴展
const Stu_pst stu3;
Stu_pst const stu4;