A typedef declaration introduces a name that, within its scope, becomes a synonym for the type given by the decl-specifiers portion of the declaration. In contrast
to the class, struct, union, and enum declarations,
typedef declarations do not introduce new types — they
introduce new names for existing types.
Example
// Example of the typedef keyword
typedef
unsigned long ulong;
ulong ul; //
Equivalent to "unsigned long ul; "
typedef struct
mystructtag
{
int i;
float
f;
char c;
} mystruct;
mystruct
ms; // Equivalent to "struct mystructtag ms; "
typedef int (*funcptr)(); // funcptr is synonym for
"pointer
// to function returning int "
funcptr table[10]; // Equivalent to "int
(*table[10])(); "
阅读(944) | 评论(0) | 转发(1) |