CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Interview Success Kit - Get Success in Job Interviews Interview Success Kit - 30,000 Interview Que. & Ans.
Covers 30,000+ Interview Questions asked in actual MNC Interviews - all with model answers.
Get Your Dream Job Now - www.vyoms.com
Sponsored Links
Interview Questions
Our Services

INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
What are enumerations?

Posted by: SWAMINATHAN on 3/13/2013

Contact SWAMINATHAN Contact SWAMINATHAN
Category C Interview Questions
Rating (3.5) By 52 users
Added on 3/13/2013
Views 707
Rate it!
Answers:

enumerations is one type of user defined data type



Posted by: sekhar

Contact sekhar Contact sekhar

Enums are group of symbolic constant each having some integer value.

enum(PASS_MARK=60,MERIT_MARK=70)

defines two symbolic constant PASS_MARK and MERIT_MARK as 60 and 70,- it could be done with #define as well.

However without specific values ,- the values are assigned automatically ,- starting with 0 for the first element and 1 for the second, 3 for the second etc.

In case if we state a number for the first element then it will increment the value of each consecutive elemts with '1'.

enum(MON=1,TUE,WED,THU,FRI,SAT,SUN);

gives the values of 1-7 to the names of days.



Posted by: Andrew Gecse

Contact Andrew Gecse Contact Andrew Gecse

enumerations can be used in place of a macros for example let us consider an example where a function is failing for many reasons like array out of bounds, divide by zero ,and memory allocation failure
when you call such a function and if something goes wrong you may not know for what reason exactly in that case you can make an enum like
enum error
{
ARRAY_OUT =0,
MEMORY_FAIL,
DIVIDE_ZERO
}
and so on instead of defining each one by macro
Then based on return value it would be easy to locate eror . And ofcourse it is a user defined type.The values assigned will be from 0 to the number of elements present . you can also assign different values in between like
enum week {
sunday, monday, tuesday=4,wednesday,thursaday}
then wednesday and thursday would have a value of 5 and 6



Posted by: shwetavg

Contact shwetavg Contact shwetavg

Enums are group of symbolic constant each having some integer value.

enum(PASS_MARK=60,MERIT_MARK=70)

defines two symbolic constant PASS_MARK and MERIT_MARK as 60 and 70,- it could be done with #define as well.

However without specific values ,- the values are assigned automatically ,- starting with 0 for the first element and 1 for the second, 3 for the second etc.

In case if we state a number for the first element then it will increment the value of each consecutive elemts with '1'.

enum(MON=1,TUE,WED,THU,FRI,SAT,SUN);

gives the values of 1-7 to the names of days.



Posted by: ranjith

Contact ranjith Contact ranjith

If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification Enter the above shown code: *
    Inform me about updated answers to this question

    Related Questions
    View Answer
    Write down the equivalent pointer expression for reffering the same element a[i][j][k][l]?
    View Answer
    What is the use of typedef?
    View Answer
    Which mistakes are called as token error?
    View Answer
    What is the function of % using in formatted string.
    View Answer
    How to print the names of employees or students in alphabetical order using C programming?
    View Answer
    How should i rate on the basis of the basis of the scenario the insertion sort , bubble sort , Quick Sort?
    View Answer
    Can we print values from 1 to 100 without using for,while,do-while,if etc.?answer should be logical.
    View Answer
    How to write a program to print its own source code?
    View Answer
    What are the advantages of pointers,give me programs containing variables and pointer variables?
    View Answer
    I want source code of series of prime numbers.
    View Answer
    There is any methodology in which we can print a string in c without using semicolon(;)
    suggest me if there is ?
    View Answer
    What is the difference between the following statements?
    int a[4]={1,2,3,4};
    int a[]={1,2,3,4);
    View Answer
    How can we get direct printout of a c file without giving print command from bin or tc?eg i want to get the printout of a program directly after execution from the c window itself.
    View Answer
    Write a C program that will convert Simple Sentence to Complex/Compound Sentence.
    View Answer
    Can anyone share his code which would accept a sentence, then count the number occurrence of the words excluding spaces.All is done using linked list.
    View Answer
    using c-strings write a program that will analyse the text"1.1my brother is taller than me.1.2 I am a boy of sixteen years old". The program should remove multiple spaces betweem words,find the longest word in the text,search and identify the number of letters"e", extact the number of integers , extract the number of doubles, extract the number of words in each sentence and identify the number of sentences in the text.
    View Answer

    Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

    View ALL C Interview Questions & Answers

    User Options
    Latest 20 Questions
    How to Retrieve a Cookie Value ?
    How to Create a Cookie?
    What is ViewState ?
    What are different methods of session maintenance in ASP.NET?
    What is cross cutting concern and concern in spring AOP ?
    What are the important beans lifecycle methods ?
    Explain the advantages of using DAO module?
    What is SQLProvider ?
    How struts application can be integrated with spring?
    What are the advantages of spring framework?
    What is ?Throws advice? in Spring ?
    What is Metadata Autoproxying ?
    Describe about DAO in Spring framework ?
    What is called an Advice ?
    What is IOC?
    What are the types of Dependency Injection?
    What are the different Modes of Autowiring ?
    Define Application context module?
    Why Spring framework is needed?
    What is called Spring MVC?


    Copyright ©2003-2016 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions

    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | C Interview Questions & Answers

    Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes


    Cache = 0.492188 Seconds