The problem here is that you are using variables. You can use constants only in switch statements.
Do something like
#define SOME_VALUE 1
or
enum Values { valuea = 1, valueb = 2, ... }
And you can use valuea etc. in the switch statement.
fresskoma
source share