Switch with array of char

Hey.

I'm trying to use the switch and an array of char togeather, since it dosent support the string.h header i figured this has to be the only way, tho it just dosent wanna work if i make the char an array, only if its a normal variable it works...

tryed to find in google but all i saw was with a single letter or number(s)

can i get an example please or a little help.

that's the code i was trying to compile


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int main()
{

char buffer [50]={0};

switch(buffer)
{
case default: << "Wrong\n";
case 'Yes':   << "Wrong\n";
case 'No':    << "Wrong\n";
case 'Correct': << "Wrong\n";
}

return 0;
}
Topic archived. No new replies allowed.