UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is meant by “enum” in C?

Asked by Last Modified  

Follow 7
Answer

Please enter your answer

Computer classes For Working professionals and studne of Engineering, MCA, Class 12,11 class 10

An enum is a keyword in C language, it is an user defined data type. All properties of integer are applied on Enumeration data type It work like the Integer.
Comments

In computer programming, an enumerated type (also called enumeration, enum, or factor in the R programming language, and a categorical variable in statistics) is a data type consisting of a set of named values called elements, members, enumeral, or enumerators of the type.
Comments

. 16yrs experience as java selenium automation Architect

n computer programming, an enumerated type is a data type consisting of a set of named values called elements, members, enumeral, or enumerators of the type. The enumerator names are usually identifiers that behave as constants in the language. An enumerated type can be seen as a degenerate tagged union...
read more

n computer programming, an enumerated type is a data type consisting of a set of named values called elements, members, enumeral, or enumerators of the type. The enumerator names are usually identifiers that behave as constants in the language. An enumerated type can be seen as a degenerate tagged union of unit type

read less
Comments

Primary Teacher

In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items. Enumeration (or enum) in C. Enumeration...
read more

 In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items.

Enumeration (or enum) in C. Enumeration (or enum) is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain. enum State {Working = 1, Failed = 0}; The keyword 'enum' is used to declare new enumeration types in C and C++.

read less
Comments

Primary Teacher

In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items. Enumeration (or enum) in C. Enumeration...
read more

 In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items.

Enumeration (or enum) in C. Enumeration (or enum) is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain. enum State {Working = 1, Failed = 0}; The keyword 'enum' is used to declare new enumeration types in C and C++.

read less
Comments

Primary Teacher

In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items. Enumeration (or enum) in C. Enumeration...
read more

 In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items.

Enumeration (or enum) in C. Enumeration (or enum) is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain. enum State {Working = 1, Failed = 0}; The keyword 'enum' is used to declare new enumeration types in C and C++.

read less
Comments

Primary Teacher

In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items. Enumeration (or enum) in C. Enumeration...
read more

 In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items.

Enumeration (or enum) in C. Enumeration (or enum) is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain. enum State {Working = 1, Failed = 0}; The keyword 'enum' is used to declare new enumeration types in C and C++.

read less
Comments

Primary Teacher

In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items. Enumeration (or enum) in C. Enumeration...
read more

 In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items.

Enumeration (or enum) in C. Enumeration (or enum) is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain. enum State {Working = 1, Failed = 0}; The keyword 'enum' is used to declare new enumeration types in C and C++.

read less
Comments

Primary Teacher

In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items. Enumeration (or enum) in C. Enumeration...
read more

 In programming Enum is a keyword defined for Enumeration a new data type. Type safe enumerations should be used liberally.In particular, they are a robust alternative to the simple String or int constants used in many older APIs to represent sets of related items.

Enumeration (or enum) in C. Enumeration (or enum) is a user defined data type in C. It is mainly used to assign names to integral constants, the names make a program easy to read and maintain. enum State {Working = 1, Failed = 0}; The keyword 'enum' is used to declare new enumeration types in C and C++.

read less
Comments

Trainer

enum The enum type specifier is short for "enumerated data". The user can define a fixed set of words that a variable of type enum can take as its value. The words are assigned integer values by the compiler so that code can compare enum variables. Consider the following code example: #include stdio.h /*...
read more
enum The enum type specifier is short for "enumerated data". The user can define a fixed set of words that a variable of type enum can take as its value. The words are assigned integer values by the compiler so that code can compare enum variables. Consider the following code example: #include stdio.h /* To shorten example, not using argp */ int main () { enum compass_direction { north, east, south, west }; enum compass_direction my_direction; my_direction=west; return 0; } This example defines an enumerated variable type called compass_direction, which can be assigned one of four enumerated values: north, east, south, or west. It then declares a variable called my_direction of the enumerated compass_direction type, and assigns my_direction the value west. Why go to all this trouble? Because enumerated data types allow the programmer to forget about any numbers that the computer might need in order to process a list of words, and simply concentrate on using the words themselves. It's a higher-level way of doing things; in fact, at a lower level, the computer assigns each possible value in an enumerated data type an integer cconstant -- one that you do not need to worry about. Enumerated variables have a natural partner in the switch statement, as in the following code example. #include stdio.h enum compass_direction { north, east, south, west }; enum compass_direction get_direction() { return south; } /* To shorten example, not using argp */ int main () { enum compass_direction my_direction; puts ("Which way are you going?"); my_direction=get_direction(); switch (my_direction) { case north: puts("North? Say hello to the polar bears!"); break; case south: puts("South? Say hello to Tux the penguin!"); break; case east: puts("If you go far enough east, you'll be west!"); break; case west: puts("If you go far enough west, you'll be east!"); break; } return 0; } In this example, the compass_direction type has been made global, so that the get_direction function can return that type. The main function prompts the user, Which way are you going?, then calls the "dummy" function get_direction. In a "real" program, such a function would accept input from the user and return an enumerated value to main, but in this case it merely returns the value south. The output from this code example is therefore as follows: Which way are you going? South? Say hello to Tux the penguin! As mentioned above, enumerated values are converted into integer values internally by the compiler. It is practically never necessary to know what integer values the compiler assigns to the enumerated words in the list, but it may be useful to know the order of the enumerated items with respect to one another. The following code example demonstrates this. #include stdio.h /* To shorten example, not using argp */ int main () { enum planets { Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto }; enum planets planet1, planet2; planet1=Mars; planet2=Earth; if (planet1 > planet2) puts ("Mars is farther from the Sun than Earth is."); else puts ("Earth is farther from the Sun than Mars is."); return 0; } The output from this example reads as follows: Mars is farther from the Sun than Earth is. read less
Comments

View 9 more Answers

Related Questions

What purpose does \n have in C programming?
is used for new line. It prints the output in New or next line
Nasar
0 0
9
Other than in a for statement, when is the comma operator used?
Example : int i,j; i=(10,20,30,40); j=10,20,30,40; printf("%d",i); printf("%d",j); // in this program output of i will be 40 and j will be 10 // In interviews you can face such type of comma operator related questions.
Sanjay
What does %d mean in the C programming language?
To specify the integer values in printf and scanf.
Vikas
0 0
6
How do I learn C programming effectively? What is the best book?
C: The Complete Reference is written by Herbert Schildt is one of the best book for beginners
Sk
0 0
7
Is it necessary to learn data structures in C language only?
data structure helpful to improve your coding stability
Vikas
0 0
8

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Basics Of C And C++
C++ is powerful, highly flexible, and adaptable programming language that allows software engineers to organise and process information quickly and effectively. But this high-level language is relatively...

C and C++ programming with memory level debugging
Understanding C and C++ programming by using memory level debugging. Step 1: Understand the Memory map of C executable Step 2: Start memory level debugging using popular IDE Step 3: Find the memory...

Array vs Linked List
Array Linked List Accessing element is easy. Accessing element is difficult compare to Array. Easy to use. Difficult to use. Memory is Fixed size. Memory is variable size. If...

Why do pointers have a datatype?
Before we start with pointers you must know what is a variable and a datatype. int a; This is the basic line in every program in 'C' . It means that we are asking the compiler to give us 2 bytes of space...

Some interview questions and answers for fresher level on Pointers
What is a void pointer? Void pointer is a special type of pointer which can reference or point to any data type. This is why it is also called as Generic Pointer. As a void pointer can point to...

Recommended Articles

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more