b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

c 计算结构体大小 C语言学习入门(11)

电脑杂谈  发布时间:2017-12-25 13:05:49  来源:网络整理

season=9;

season=winter;//等价于season=20;

printf(“season= %d\n”,season);

int*p = &season;

printf(“p=%d\n”, *p);

}

关键字:typedef

用法:为各种数据类型定义一个新名字(别名)

typedef与基本数据类型

typedefintInteger;Integer a=8;

也可以在别名的基础上再起一个别名

typedefIntegerMyInteger;MyInteger aa = 8;

原来的数据类型也可以正常使用

typedef与指针

typedefchar*String;String str = “stone”;

typedef与结构体

typedefstructPersonPer;//这样在定义结构体变量时 就不用带上struct 关键字了

Per p; p.name = “xyz”;

定义并取别名:

typedefstructStudent// 结构体名 Student 可以省略

{

intage;

} Stu;

voidprocessStudent()

{

Stustudent = {18};

student.age=19;

}

typedef与指向结构体的指针


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-55787-11.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...