View Single Post
Old 09-17-10, 01:51 AM   #1
mr_mooo
Registered User
 
Join Date: Sep 2010
Posts: 2
Default C programming issue

Hey all,

I am fairly knew to the scene of C programming and I am having trouble with something I am trying to do.

I have an char array which contains a binary value of the output of 5 sensors. i.e. 00111

What I want to do is create a state machine from this array. I have tried using a switch statment..

switch (sensor_values)
{
case "00011":
// do somehing
break;
case "11000":
// do something else
break;
default:
break;
}

but I get the error "switch expression has illegal type"

Can i convert the array to something else so I can use my case statement or is there a better method?

Cheers,

Mr_Mooo
mr_mooo is offline   Reply With Quote