数据结构之typedef在结构体中的用法

/*
    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 *
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;
}
posted @ 2019-10-12 19:27  包莹莹  阅读(1744)  评论(0编辑  收藏  举报