.typedef的用法 # include <stdio.h> typedef int zhang; //为数据类为int从新取名为zhang 等价于int
typedef struct Student
{
int sid;
char name[];
char sex;
}ST; int main(void)
{
int i = ; //等价于 zhang i = 10;
struct Student st; //等价于 ST st;
struct Student * ps = &st; //等价于ST * ps;
zhang j = ; printf("%d\n", j); ST st2;
st2.sid = ;
printf("%d\n", st2.sid); return ;
}
.typedef的用法2 # include <stdio.h> typedef struct Student
{
int sid;
char name[];
char sex;
}* PST; //等价于struct Student * int main(void)
{
struct Student st;
PST ps = &st;
ps->sid = ;
printf("%d\n", ps->sid); return ;
}
.typedef的用法3 # include <stdio.h> typedef struct Student
{
int sid;
char name[];
char sex;
}* PSTU, STU; //等价于STU代表了 struct Student, PSTU 代表了struct Student * int main(void)
{
STU st; //等价于 struct Student st;
PSTU ps = &st; //等价于 struct Student * ps = &st;
ps->sid = ; printf("%d\n", ps->sid); return ;
}