class Name { memeber_of_class };
const Type Name = Value;
Type Name;
Type *Name;
Type Name[Constant];
Sometimes we want to attach a name to a type of data. The syntax allows many forms:
typedef Type Name;
typedef Type *Name;
typedef Type Name[Constant];
Syntactically a typedef statement is a variable declaration prefixed with the word "typedef" - no spaces, all lowercase!
Semantically they do not create a variable. No storage is allocated. The declare a short name for what would be a long description of a type:
typedef stack<char> charstack;
typedef queue<Customer> Line;
typedef list<Student> Roster;
typedef vector<double> RowVector;
typedef double Vector [250];
The name in the typedef can only be used to declare variables and constants.... and also to define other types using typedef.
The usual advice holds: