2013年11月25日 星期一

enumeration



inf : http://answers.yahoo.com/question/index?qid=20061219045609AAXY2Da


enum state
{
open = 0,
close = 1,
connecting = 2,
connected = 3,
disconnecting = 4,
disconnected = 5
}


An enumeration is a data type consisting of a set of named values that represent integral constants,
known as enumeration constants.
An enumeration also referred to as an enumerated type because you must list (enumerate)
each of the values in creating a name for each of them.
In addition to providing a way of defining and grouping sets of integral constants,
enumerations are useful for variables that have a small number of possible values.

Another Definition:
An enumeration is a user-defined type consisting of a set of named constants called enumerators.

沒有留言:

張貼留言