Tuesday, May 6, 2008

C++学习笔记(二) -- typedef

typedef 定义新的类型名的方法:
1. 先按定义变量的方法写出定义体 (如: int i[100];)
2. 将变量名换成新类型名 (如: 将 i 换成 COUNT)
3. 在最前面加 typedef (如: typedef int COUNT[100];)
4. 然后可以用新类型名去定义变量

No comments:

Post a Comment