Defines a set of constants of type int.
The syntax for defining constants using enum is
enum [tag] {name [=value], ...};
The set can optionally be given a type tag name with tag.
name is the name of a constant that can optionally be assigned the (constant) value of value, etc.
For example,
enum Numbers {One = 1, Two = 2, Three = 3, Four = 4, Five = 5};
If value is missing, then a value is assumed to be the value of the previous constant in the list + 1.
If this is the first constant in the list, the default value is 0.
The syntax for defining constants using enum is
enum [tag] {name [=value], ...};
The set can optionally be given a type tag name with tag.
name is the name of a constant that can optionally be assigned the (constant) value of value, etc.
For example,
enum Numbers {One = 1, Two = 2, Three = 3, Four = 4, Five = 5};
If value is missing, then a value is assumed to be the value of the previous constant in the list + 1.
If this is the first constant in the list, the default value is 0.
No comments:
Post a Comment