Enumerated type is a user-defined data type used in computer programming to map a set of names to numeric values. Enumerated data type variables can only have values that are previously declared. In other words, they work with a finite list of values.
Enumerated data types help make the code more self-documenting and prevent programmers from writing illogical code on values of enumerators. Enumerated data also hides unnecessary details from programmers.
Enumerator names usually behave as constants in programming languages, although they are identifiers in most ways. A variable assigned as enumerated type can have any of the enumerators as value.
In certain languages, enumerator data types many be built into the language. Many programming languages permit users to define new enumerated types and certain programming languages also define the ordering that needs to be followed for the members associated with enumerated data types. The enumerators are unique, but certain programming languages do permit the enumerator to be listed twice in the declaration of the type.
0 Comments