Name
typedef
Synopsis
The keyword typedef
is used to give a type a new name.
Examples:
typedef unsigned char UCHAR; typedef struct { double x, y } POINT;
After these type definitions, the identifier UCHAR
can be used as an abbreviation for the type unsigned
char
, and the identifier POINT
can be
used to specify the given structure type.
Examples:
UCHAR c1, c2, tab[100]; POINT point, *pPoint;
In a typedef
declaration, the identifier is
declared as the new type name. The same declaration without the
typedef
keyword would declare a variable and not a
type
name.
Get C Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.