码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2019-10-12 21:02:25      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:def   应用   用法   结构   print   struct   include   数据   strcpy   

/*
    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;
}

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

标签:def   应用   用法   结构   print   struct   include   数据   strcpy   

原文地址:https://www.cnblogs.com/baoyingying/p/11663532.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!