Enumerted type =============== /* Compute the next day. */ enum day {sun, mon, tue, wed, thu, fri, sat}; typedef enum day day; day find_next_day(day d) { day next_day; switch (d) { case sun: next_day = mon; break; case mon: next_day = tue; break; ..... case sat: next_day = sun; break; } return next_day; } /* Compute the next day with a cast. */ enum day {sun, mon, tue, wed, thu, fri, sat}; typedef enum day day; day find_next_day(day d) { return ((day)(((int) d + 1) % 7)); }