What is the difference betwen enumrerated datatype and typedef?

Answer

Its very Simple that using Enumerated data type you are making special integers that flow within range, While a typedef is redefining data type with new name. Example: like defining enum Days{sun,mon,tue.....} makes an integer definition that can have 0-7 values So if u do following: Days x=sun; or Days x=0; then x=x+2; is 2 or tue and x=x+7; is 0 or sun again... Means its modulo 7 data type ................. While doing this: typedef Days WeekDays; renames Days as WeekDays Similary typedef int NUMBER; renames int as NUMBER .But wait it is one more name for the data type.. So simply enum creates a numeral modular datatype with a range while typedef creates another name for it. Rupesh K Joshi

 

Improve Answer Discuss the question "What is the difference betwen enumrerated datatype and typedef?" Watch Question

First answer by ID996041274. Last edit by ID996041274. Question popularity: 41 [recommend question]


Research your answer:

Can you answer other questions about computers and the net?

Answers.com > Wiki Answers > Categories > Technology > Computers > What is the difference betwen enumrerated datatype and typedef?

Our contributors said this page should be displayed for the questions below. (Where do these come from)
If any of these are not a genuine rephrasing of the question, please help out and edit these alternates.
What is enumerator?  What are enumerator?  What is enum in c language?  What is enumerator datatype?  What is enumerated datatype in c?  What is the difference between enumerations and typedef in c?  What is difference between abstract datatype and primitive datatype?