Hi. I used the following code, and appeared the error "error C110: non-constant case/dim expresion" at the "case" line, what does it mean? ...
void main(void){ char command[]={1,2,3,4,5,6,7,8}; char word; //........ while(1){ /* ......... some lines of code */ switch(word){ case command[0]: // do somthing break; //................... case command[7]: // do somthing break; } } }
Thank you.
It has nothing to do with the const keyword. It has to do with not being a variable or function.
enum { CMD1 = 1, CMD2, CMD3, ... }; switch (command) { case CMD1: // handle command 1. break; case CMD2: // handle command 2. break; ... default: // Unknown command. ; }
Thank you for details and helping me... Have a nice day or good night - where you are...
Damian.