August 2001
Beginner
482 pages
10h 52m
English
It can become tedious, repetitious, and, most important, error-prone to keep writing unsigned short int. You can create a synonym for an existing type by using the keyword typedef, which stands for type definition. |
It is important to distinguish this from creating a new type (which you will do in Hour 7, “Basic Classes”). typedef is used by writing the keyword typedef followed by the existing type and then the new name. For example,
typedef unsigned short int USHORT
creates the new name USHORT that you can use anywhere you might have written unsigned short int. Listing 3.3 is a replay of Listing 3.2 using the type definition USHORT rather ...
Read now
Unlock full access