case 'C':
case 'c':
switch (*comm++)
{
case 'S':
case 's':
command = STATUS;
break;
}
break;
Tell me why it is necessry to use this switch case format like C,c,S,s?
is ther any concept behind this implimentation.
so just give me the some idea behind this things.
actually this code is related to serial command.
and i also want to do this things for my serial comm.
I assume that you are asking if this is a case sensitive statement,
everything is case sensitive in C, so if you use 'c' only then upper case 'C' will not be recognized,
this is why both upper and lower case letters are used in the code you have provided.
I hope your are not confused with C,c,S,s. If yes then the answer is -- The switch case statement and and "if" condition statement both work identical. In your case let's say we have 2 options and 2 sub-options. The first main option say C executes some true condition and if this is true then it will execute the sub-option c option.
Switch C:
case c:
Switch S:
case s:
case s1:
etc etc
case c1:
etc. etc.
So there are many way to use switch statements like the "if" statements.
each letter has a unique code in computer
c and C r 2 different numbers for computer
and if u use case c: and case C:
without break statement then the next statement is executed in both cases acting as an OR operation