#include typedef enum my_time { day, night } my_time; int main(){ // my_time t1 = 1; <-- will not compile int t2 = night; return
You could cast to int. This expression makes an explicit conversion of the specified data type (int) and the given value (night).
int t2 = static_cast(night)