typedef Statement in C Programming
In C programming, we can define new data type names by using keyword typedef
. Here we are not creating new data types but we are giving a new name to the existing data types.
These new names given to existing data types are also known as user defined data types.
typedef Statement Syntax
typedef type new_name;
Where,
type
is any valid C data types and new_name
is any valid C identifier.
typedef Examples
typedef int myint;
Now we can use myint
just like int
i.e. myint a,b,c;
creates a, b and c as integer variables.
typedef double db;
Now we can use db
just like double
i.e. db x;
creates x as double variable.