§ enum is
“Enumerated Data type”.
§
enum is user-defined data type.
§
Syntax:
enum
identifier (Value1, Value2, Value3,……Valuen};
o
In the above syntax, “identifier” is a
user-defined data type.
o
Value1,Value2,…. are the set of enum
values (called Enumerated Constants)
o
Using
“identifier” we are creating our variables.
§ After
this definition, we can declare variables to be of this “new” type.
enum
identifier v1,v2,….vn;
o
The enumerated variables can only have one
of the values Value1,Value2,…
o
Default numeric value assigned to first
enum value is 0.
o
Generally printing value of enum variable
is as good as printing “Integer”.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.