c++中,除define以外,能不能给一种数据类型取别名呢?当然有,typedef就是一个。
如下:
/*对比代码*/
#define uint unsigned int;//将unsigned int用宏定义的方式使“unsigned int”可以用“uint”替代
typedef unsigned int uint;//将unsigned int用类型定义的方式使“unsigned int”可以用“uint”替代
本质上都是将unsigned int 用uint替代。
过于易懂,所以到此结束。