enum is a keyword to create enumerated datatype in C/C++. This is a user defined data type.
Some of the variables will hold only some specific values. For example, if a variable is used to store month, all the possible values it can hold is from January to December. No other values can be stored in that variable. These type of variables can be created as enumerated data type.
The definition of the same is as follows:
enum month ={ "january", "feburary", "march", "april", "may", "june", "july",
"august", "september", "october", "november", "december"};
Now month is one type of data type. you can create variables using that data type as follows
month m1, m2;
m1 and m2 are the variables which can hold only the values i.e., january to december as given in the declaration.
2006-11-27 22:03:45
·
answer #1
·
answered by SHIVA 2
·
0⤊
0⤋
In some programming languages, enum is a keyword used for introducing an enumerated type.
Michael
http://www.webmasterautomation.com/blog/
2006-11-28 05:47:09
·
answer #2
·
answered by Anonymous
·
0⤊
0⤋
enum is used to enumerate a list of words, such as the days of the week. basically, it assigns the first word in the list with the number 0 (by default), and every word after it is assigned the next number. for example:
enum{
monday,
tuesday,
wedensday,
thursday,
friday,
saturday,
sunday
}
monday will be equal to 0, tuesday equal to 1, wedensday equal to 2, etc...
you could also start at any number you want by putting "monday = 3" you start the numbering at 3.
now, in your code, instead of trying to rember numbers for the days, you just use the word.
2006-11-28 09:08:54
·
answer #3
·
answered by justme 7
·
0⤊
0⤋
In what context? I use it to signify enumerated types, but I guess you could use it for other things too.
Rawlyn.
2006-11-28 05:51:01
·
answer #4
·
answered by Anonymous
·
0⤊
0⤋