Can somebody explain the STATE function in C++?

I'd like to know more about the concept of State Machines, and have seen code that has STATE in the body of the C++ code, but it is not in the Main. Can someone give me a beginners overview of how this functionality works? What has to be declared in that portion of the code?

A state machine is an abstraction -- and a very simplistic (but complete) one at that. Read more about them here:
http://en.wikipedia.org/wiki/State_machine
http://en.wikipedia.org/wiki/Turing_machine

All computers and computer programs are state machines.


In C and C++ (and all other computer languages) an object (integer, string, etc) stores state -- meaning that it remembers the way a thing is -- while the code represents the transitions if (x == 12) ... else ....

So long as an object exists (its lifetime) it represents part of the program's state.

Hope this helps.
Topic archived. No new replies allowed.