An enumerated type is a user-defined data type that consists of a set of
named integer constants. Enumerated types improve program readability by allowing
meaningful names to be used instead of numeric values.
named integer constants. Enumerated types improve program readability by allowing
meaningful names to be used instead of numeric values.
SYNTAX:
enum status { PASS, FAIL };
EXAMPLE:
#include <stdio.h>
enum switch_state { ON, OFF };
int main() {
enum switch_state bulb = OFF;
if (bulb == ON) {
printf("The room is bright!");
} else {
printf("The room is dark.");
}
return 0;
}