Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

ghbolivar said:
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)

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top