19:09
@du4ko what?! switch case vs pointer function? what is a pointer function? what are we talking about? :)
btw you don't need to know more on FSM that what has been said in the wiki-page:
A finite-state machine (FSM) or finite-state automaton (FSA, plural: automata), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number of states at any given time. The FSM can change from one state to another in response to some external inputs; the change from one state to another is called a transition. A FSM is defined by a list of its states, its initial state, and the conditions for each transition.
The behavior of state machines can be observed in many devices in modern society that perform...
well, if you have any question particular to a corner case, or a specific scenario, then ask, but the main concept is fairly easy, to implement and work with is also straightforward.. so, yeah, be specific :)
@KirkBrodie what you are doing there, is a valid C99+ code, and it is called the variable-length-array
I don't know if you are looking for that or not, but it is a thing
basically you are defining the size of the array on runtime, but in the stack instead of the heap (note: neither stack not the heap are standard based expressions, the standard does not care about these memory concepts)
anyway, as such, it is very fragile, and you can easily get stack overflow -- so consider it twice, before you are actually using that feature
(it can be useful, and can have its usecases, especially if you know your hardware's limitations, and you can estimate the number 'a' in a range, which is in the range of your limitation
anyway, since those are "allocated" on the stack, you can't return them, because they will cease to exist once they go out of scope, which will happen at the end of the function call
so if you need something that will outlive your function, then you should allocate them on the heap, with the "malloc" function for instance