c/c++语言中的typedef相信大家已经不陌生,本文对c/c++语言关键字typedef的各种用法作一个介绍。
typedef,顾名思义,为“类型定义”,可以解释为:将一种数据类型定义为某一个标识符,在程序中使用该标识符来实现相应数据类型变量的定义。例如:
typedef unsigned int uint;
int main (int argc, char *argv[])
{
unsigned int a; // it’s ok
uint b; // it’s ok, a and b are of the same type (int)
// . . . // code references the symbol a and b
return 0;
}