You might know that x
is a constant but the compiler cannot guarantee it: it is still possible to modify x
in C. One way is by taking its address (via a pointer) and dereferencing it.
In C you can only switch on literal integral types; more formally, a constant expression.