I was having discussion about State Machines with one of my friend, regarding pro’s and con’s of implementing programs as Sate Machines, it was then that i realised there is no simple way to implement programs as Finite State Machines, so here is a very basic implementation of FSM in C

file: fsm.h contains the function definition for our FSM


file: fsm.c contains the function implementation for our FSM

file: main.c contains an example on how this FSM can be used

PS – If you are reading this post on a blog aggregator like planet you can view full post here