GeekInterview.com
Series: Subject: Topic:
Question: 241 of 357

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

Asked by: Interview Candidate | Asked on: Jun 24th, 2005
Showing Answers 1 - 2 of 2 Answers
mahesh kumar

Answered On : 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.

  
Login to rate this answer.

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.

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.