数据结构之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;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM