4.3 Enumeration
Enumeration types (enum): -
- Enumeration is a user defined data type that assigns names (strings) to integer constant values.
- We can write strings in the form of integers.
- Every string starts from 0 to (n-1) integer constant values by default.
- If we provide a value for a string the increment starts from the value by 1.
- Enum is a keyword used for enumeration.
- It makes code more readable and maintainable by letting you use descriptive names instead of raw integers.
Example: -
Output: -