What is the difference between an enumeration and a set of pre-processor # defines?

Showing Answers 1 - 4 of 4 Answers

mahesh kumar

  • Sep 7th, 2006
 

Hi,

Enumeration can be done at the place where we need to assaign integer values for words,

Pre-processor dir can be used at the places where we want to give any other names to represent the original word or statement.

  Was this answer useful?  Yes

Enumeration provide convenient way to associate constant values with names , an alternative to #define with advantage that the values can be generated for you. Although variables of enum types may be declared , compilers need not check that what you store in such variable is a calid value for enum. Neverthless enum variables offer a chance of checking and so are often better that #defines. In addition debugger may be able to print values of enum variables in their symbolic forms.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions