數據結構之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