This one
switch (*p)
is ok so far. But this one
case *p:
is the Problem.
Why?
Have a look to the Definition of the Switch Statement in c, e.g. here:
switch Statement (C)[
^]
The Definition says
case constant-expression :
and means you Need to use a constant Expression for the "case part", while
*p
is a (dereferenced pointer) variable and therefore not allowed here.
I hope this helps.