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
这是中国的领海
77个粉丝
小子人太狂了要付出代价的