Skip to main content

Practice · 3 of 4

State Machine Step

CHALLENGE
Difficulty: beginner+25 XP

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.

Back to lesson: Practice: Enum Practice