Best 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

User Avatar

Wiki User

βˆ™ 2005-09-29 12:49:49
This answer is:
User Avatar
Study guides

What are advantages of Database Approach

What is a network that covers a large geographical area such as a city country or world

What is the worlds largest wan

What is a network server

See all cards
104 Reviews

Add your answer:

Earn +20 pts
Q: What is the difference between enumrerated datatype and typedef?
Write your answer...
Still have questions?
magnify glass
Related questions

What is the difference between a macro and typedef?

A Macro is a preprocessor directive means that before compilation the macros are replaced. Where as typedef is defining a new data type which is same as the existing data type. Syntax: typedef Existing datatype New datatype For example typedef int NUMBER; Here NUMBER (New datatype)is defined as a data type which contains the properties same as int(Existing datatype). You can declare a variable of int as NUMBER a; is same as int a; similarly typedef int* NUMBERPOINTER; NUMBERPOINTER a; Here a is a pointer of integer type.

C program to swap two numbers using pointers as function aruguments?

Voila: typedef float DataType; void swap(DataType* const a, DataType* const b) { DataType c = *a; *a = *b; *b = c; }

What is the difference between Typedef and Reference in C plus plus?

A typedef is a compiler macro. A reference is a pointer, usually implemented with transparent syntax. They have no relationship between each other.

What is difference between define and typedef in c plus plus?

#define is a preprocessor directive used to declare macros. typedef is a C++ keyword to define a data type.

What is typedef in c programming language?

A typedef is a type definition.

Difference between define and typedef?

typedef keep the property of attributes whereas #define won't for example #define char* m_type typedef char* p_type m_type a, b; p_type c,d In above case a, c and d are pointer types , where as b in char type only. Which is not our intention. In another example which shows #define keeps string attributes whereas typedef won't. #define int INT; typedef int MYINT unsigned MYINT a; unsigned INT a; The above example won't work as it won't change to unsigned int a. And in #define case it will simply works!!!.

Typedef int a a a Is this possible in C?

No, but 'typedef int a;' is possible, it defines the type 'a'.

What is the function of typedef statement?

typedef is used to create user defined data types

What are the Uses of typedef?

the purpose of typedef is to redefine the name of an existing variable type. e.g. typedef unsigned long int T; T v1,v2;

What is the difference between Typecast and Typedef?

Typecasting is to make a variable of one type, act like another type for one single operation. Type-def is to assign alternative names to existing types.

What is a typedef in C programming?

A typedef is a type definition. That is, we are defining a new type. In some cases, a typedef is merely an alias for an existing type. We typically use aliases as a shorthand for complex types: typedef unsigned long ULONG; Here, we can use the alias ULONG in place of unsigned long. We can also use typedef to define user-defined types, such as structures and unions: typedef struct person { char* first_name; char* last_name; int age; };

What is the use of type def in c?

A typedef is used to define a type. The clue is in the name: typedef = type definition.

People also asked