[prev] 78 [next]

Defining New Data Types

C allows us to define new data type (names) via typedef:

typedef ExistingDataType NewTypeName;

Examples:

typedef float Temperature;

typedef int Matrix[20][20];

We will frequently use Bool whenever we want to stress the fact that we are interested in the logical rather than the numeric value of an expression:

typedef int Bool;