Skip to main content

Practice ยท 3 of 4

State Machine Step

Given typedef enum { IDLE, RUNNING, PAUSED } State; in scope, implement State step(State s, int event): from IDLE event 1 goes RUNNING; from RUNNING event 0 goes PAUSED; from PAUSED event 1 goes RUNNING; anything else stays.

Difficulty: beginner

Back to lesson: Practice: Enum Practice