Typedef

From Tux
Jump to: navigation, search

typedef can be used to rename a data type. The last identifier is the renamed type, while everything between typedef and it is what it can be used in place of.

typedef unsigned long int myint;

// The following two variable declarations are equivalent given the above typedef
unsigned long int x;
myint x;

typedef statements can be made global.