Skip to Main Content
Programming and Data Structures
book

Programming and Data Structures

by Ashok Kamthane
August 2009
Intermediate to advanced content levelIntermediate to advanced
604 pages
21h 39m
English
Pearson India
Content preview from Programming and Data Structures
Structure and Union 393
1Z8 typedef
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.
ty p e d ef type dataname;
Here, type is the data type and dataname is the user defined name for that type,
typedef in t 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.
td e fin e H 60
m ain()
{
ty p ed ef in t hours;
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.
Start your free trial

You might also like

Learning Data Structures and Algorithms

Learning Data Structures and Algorithms

Rod Stephens
Data Structures and Algorithms in C++, Second Edition

Data Structures and Algorithms in C++, Second Edition

Michael T. Goodrich, Roberto Tamassia, David M. Mount

Publisher Resources

ISBN: 9789332506343