answersLogoWhite

0

What is Enum and why use in your program?

Updated: 8/17/2019
User Avatar

Wiki User

14y ago

Best Answer

The enum keyword provides a handy way to create a sequence of integer constants in a concise manner. Optionally the declaration can include a name for the sequence after the enum keyword. The constant names follow with a comma and placed within braces. The name assigned can be used to call the function again at later stage. The constants can be assigned any individual value but the following constant will always increment it by one.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is Enum and why use in your program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Is the part of the program in which a variable may be accessed?

Your class, enum or getter methods.


Enum in java?

Enum in java is a keyword which is introduced in JDK 1.5 and its a type like Interface and Class.Enum constants are implicitly static and final and you can not change there value once created. Enum in Java provides type-safety and can be used inside switch statment like int variables. Since enum is a keyword you can not use as variable name and since its only introduced in JDK 1.5 all your previous code which has enum as variable name will not work and needs to be refactored.


What is meant by enum in C programming?

The enum keyword means enumeration.


How do you pass enum object as argument to function in c?

You can't pass an enum as an argument to a function. An enum in C isn't an object, it's a type. All you can do is pass a variable that is of the particular enum's type.


When was Kadhal Enum Nadhiyinile created?

Kadhal Enum Nadhiyinile was created in 1989.


What is enum type?

An enum type is a type whose fields consist of a fixed set of constants


What are Java enums?

An enum, short for enumerated type, is a variable type that can only take on the values that are declared inside the enum declaration. An enum is declared like a class, except the word "class" is replaced by the word "enum", and the class body is replaced by a list of values that a variable of that type can take on. You can also include methods, instance variables, and constructors in an enum.


How do we declare enmurated data type?

Enumerated data types can be declared using the enum keyword followed by the name of the enumeration and a list of possible values enclosed in curly braces. Each value is separated by a comma. For example, enum Color { Red, Green, Blue } declares an enumeration named Color with three possible values: Red, Green, and Blue.


How would you write a program that read an integer for display each of digit of integer in English?

Use an enum if you are using a c style language. Or a map data structure. Assign each integer an English value and then match it to what the user inputs.


In c plus plus you cannot assign integer value to enum?

That is correct - In c plus plus you cannot assign integer value to enum - You can only assign an enum value to an enum. Even though an enum looks like an integer, it is not. It is an enum, and C++ implements strict type checking to reduce the probability of bad programming practices. enum ColorCode {black, brown, red, orange, yellow, green, blue, violet, grey, white}; ColorCode myColorCode; myColorCode = yellow; Even though yellow has an integer value of 4, you cannot say myColorCode = 4.


What is the ingredients in jav enum?

Java enum is not a consumable product. Java enum is a type of computer language that allows internet users to surf the internet with more ease and makes the transition between graphics and text more fluid.


What is enum in c sharp?

Enum in C#, most of time, are used to defined integer-based values in symbolic ways.Example - exiting or return codesTraditionally, when a program exits, it may return an integer value to indicate the status of the execution.0 everything is OK1 Something was wrong, but not fatal2 Fatal Errorpublic enum ExitCode {OK = 0, Warning = 1, FatalError = 2}... return ExitCode.OK; // old way would by return 0; and one would need to know 0 stands for