Инициализация из исходного значения

Перечисления

//the last member counts the others
enum Season {
    Summer, Fall, Winter, Spring, SeasonCount
};

//an int converts to an enum without a cast
enum Season winter = 2;
bool isWinter = winter == Winter;
//isWinter is true

//C does not check the value: check the range yourself
int raw = 7;
bool valid = raw >= 0 && raw < SeasonCount;
//valid is false

printf("isWinter is %s\n", isWinter ? "true" : "false");
printf("valid is %s\n", valid ? "true" : "false");