This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Switch and Case structure

I am trying to do a simple function to return values based on the input...shown below.

char func (unsigned char add)
{
signed char i;
switch (add)
{
case 0: i = 0; break;
case 1: i = 1; break;
case 2, 3, 4, 9: i = 9; break;
case 10: i = 10;break;
default: i = 99;break;
}
return i;
}

When i try to call func(2), it automatically jumps to the default....
Does the Keil C compiler support the multiple list case structure?

MG

0