explicit

enum

The enum type specifier is used to create enumeration types. An enumeration is simply a list of named integer constants. The general form of an enumeration is shown here:

enum name {name-list} var-list;

The name is the type name of the enumeration. The var-list is optional, and enumeration variables can be declared separately from the type definition. The following code declares an enumeration called color and a variable of that type called c. It then performs an assignment and a conditional test.

enum color {red, green, yellow} c;   c = red; if(c==red) cout << "is red\n";

NOTE: For more information on enumerations refer to “Enumerations” in Chapter 1.




C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net