|
A typedef is a user-defined synonym for an existing type. To create a synonym for a type, you use the keyword typedef followed by the name of the type and the new name you are defining. Because typedef is a C++ statement, you also need a closing semicolon:
typedef unsigned int positiveNumber;
This typedef declares positiveNumber to be a synonym of unsigned int and can be used in a declaration instead of the actual type name:
positiveNumber one, two;
|