Subj : Re: implementation of finite state machine To : comp.programming From : pete Date : Thu Oct 06 2005 12:43 pm Roman Mashak wrote: > > Hello, Dave! > You wrote on Thu, 06 Oct 2005 10:11:59 +0100: > > ??>> Could you please point me to some resource, describing sample > ??>> implementation of FSM in C language, just to better catch > ??>> idea. TIA. With best regards, Roman Mashak. E-mail: mrv@tusur.ru > > >What approaches have you tried so far? > > Due to my understandanding of FSM, > I used 'if-elseif-else' chain. Might me > there are other ways and more efficient methods? Use an array of function pointers. The index into the array, is the state. The state is updated either as the return value of the function call or the address of the state object can be passed as an argument. -- pete .