QP School

Full Version: Enumerations in C
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Enumerations define a set of named constants.

enum Color {
    RED,
    GREEN,
    BLUE
};

int main() {
    enum Color color = GREEN;
    if (color == GREEN) {
        printf("Color is Green\n");
    }
    return 0;
}