What is the similarity between ENUM & MACRO in C?

Status
Not open for further replies.

sacrpio

Member level 3
Joined
May 24, 2004
Messages
56
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
500
question on C

1)
Supposse we define
enum month(jan, feb,march,april,may);
how many bytes it takes in memory.

2)
what is similarity between ENUM & MACRO?
 

Re: question on C

1)Compiller it store as integer ??? (not sure)
2)#DEFINE is only compilation time and when debugging program, you see only variables as 0,1,2 .... ,but ENUM must show as jan, feb, march .....
 

Re: question on C

ENUM is type int.
When using enumeration types, it is important to remember that each declaration of an integral type is different from all the other (and therefore also different from the int type). These different types cannot be mixed in an expression. (cause a syntax error)
 

Re: question on C


Storage required for type enum is compiler dependend; take e. g. the ra!sananc€ compiler and you will detect some selection about byte (char) or word (int) for enum type.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…