Problem addressing char array

I have two variables
char command[3][10] {"ignore", "start", "stop"};
and
char dataReceived[10];

The idea is to be able to compare any one of the three commands to the value stored in dataReceived. I have this

if (dataReceived == command[0]) // ignore
{
// do something
}
if (dataReceived == command[1]) // start
{
// do another thing
}
if (dataReceived == command[2]) // stop
{
// do something altogether different
}

but the things I want to do don't get done.

How do I compare these data?
Last edited on
1
2
if (strcmp(dataReceived, command[0]) == 0)
...


http://www.cplusplus.com/reference/cstring/strcmp/
Thanks, I would never have found that. :(
Topic archived. No new replies allowed.