Did you really try?
Well, I did (gcc on Mac OS X).
! is a logical negation operator as well! (x) returns 1 for x from 0 and 0 for anything else. 'a' has a value that is known at compile time, so the compiler evaluates !('a') to 0. So
case !('a'):
is equivalent
case 0 :
It does not even generate a compiler error and works great.
I believe that this is not what you want to do, and rather you want a case that would catch all the values โโexcept "a", and not a single value of 0. Sorry, but the case-switch statements do not work this way, The expression following the case keyword must be a value known to the compiler.
source share