C example: [state machine] use array/link list to control state