Table of Contents
Previous Section Next Section

Defining New Type Names Using typedef

You can create a new name for an existing type using typedef. Its general form is

typedef type newname;

For example, the following tells the compiler that feet is another name for int:

typedef int feet;

Now, the following declaration is perfectly legal and creates an integer variable called distance:

feet distance;

Table of Contents
Previous Section Next Section