资讯

在C语言编程中,typedef 和 #define是最常用语句,可能很多工作过两三年的工程师都没有去深究过它们的一些用法和区别。 一、typedef的用法 在C/C++语言中,typedef常用来定义一个标识符及关键字的别名,它是语言编译过程的一部分 ...
typedef是C语言的一个关键字,用来给某个类型起个别名,也就是给C语言中已经存在的一个类型起一个新名字。 大家在阅读代码的过程中,会经常见到 typedef 与结构体、联合体、枚举、函数指针声明结合使用。
To typedef, or not to typedef? The way to declare structs (as well as unions and enums) in C is quite peculiar because the identifier following the keyword ‘struct’ is a tag (e.g., struct Foo {…};).
They are used alot in Win32 as well. typedef's increase the readability of the code IMHO.<BR><BR>Question: Why do you need to know the base type? If I need to know what a type is, I look in the docs.