typedef in C: Syntax and Examples

typedef is a keyword used to define a new data type in C. It is used for making programs machine independent. It is also used for the documentation of the code and making the code easier to read.


typedef type name;

where, name is a new name for the data type.


typedef int marks;

Here, we are informing the compiler that marks is a new name for data type int.

Leave a Reply