enum example c programming

#include <stdio.h>

// Define an enumeration named 'Color' with three constants: RED, GREEN, and BLUE.
enum Color {
    RED,
    GREEN,
    BLUE
};

int main() {
    // Declare a variable 'myColor' of type 'enum Color' and assign it the value RED.
    enum Color myColor = RED;

    // Use a switch statement to check the value of 'myColor' and print the corresponding message.
    switch (myColor) {
        case RED:
            printf("The color is RED\n");
            break;
        case GREEN:
            printf("The color is GREEN\n");
            break;
        case BLUE:
            printf("The color is BLUE\n");
            break;
        default:
            printf("Unknown color\n");
    }

    return 0;
}