/*
2019年10月12日19:25:25
說明:typedef在結構體中的應用
*/
#include<stdio.h>
2019年10月12日19:25:25
說明:typedef在結構體中的應用
*/
#include<stdio.h>
typedef struct Student
{
char name[9];
int age;
}STU,*PSTU; //STU相當於struct Student,PSTU相當於struct Student *
{
char name[9];
int age;
}STU,*PSTU; //STU相當於struct Student,PSTU相當於struct Student *
int main(void)
{
STU st; // 相當於struct Student st;
PSTU pst = &st; //相當於struct Student *pst
strcpy(pst->name,"蠟筆小新");
pst->age = 5;
printf("%s今年%d歲了\n",pst->name,pst->age);
return 0;
}
{
STU st; // 相當於struct Student st;
PSTU pst = &st; //相當於struct Student *pst
strcpy(pst->name,"蠟筆小新");
pst->age = 5;
printf("%s今年%d歲了\n",pst->name,pst->age);
return 0;
}