By using typedef we can create new data type. The statement typedef is to be used while defining
the new data type. The syntax is as given under.
typedef type dataname;
Here, type is the data type and dataname is the user defined name for that type,
typedef int hours;
Here, hours is another name for int and now we can use hours instead of int in the program as
follows.
hours hrs;
Examples based on the above are illustrated as under.
12.16 Write a program to create user-defined data type hours on int data type and use it in
the program.
tdefineH 60
main()
{
typedef inthours;
hours
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.