Game State Pattern in C

Recently I’ve begun to write some sort of game/demo system from scratch in which I needed some kind of mechanism for states management. That’s because I didn’t want to drown in tons of switch statements.
Long time ago, I’ve stumbled upon managing game states in c++ article. Ideas presented there are good, but there was no option for me to use pure virtual functions and all that fancy C++ stuff, because of low memory & cpu budget. But still, I wanted to use similar mechanisms in my C program.
The code below isn’t platform dependent, so you can use it in your own programs on any platform. To get something from this article you should know something about C programming. I also suggest to check out the article about the C++ approach to get the overall idea what program state management is all about.