what does this syntax of switch case mean in C? -
i saw c code this: int check = 10:
switch(check) { case 1...9: printf("it 2 9");break; case 10: printf("it 10");break; }
what case 1...9:
mean? standarded?
it's gnu c extension called case range.
http://gcc.gnu.org/onlinedocs/gcc/case-ranges.html
as noted in document, have put spaces between low , high value of range.
case 1 ... 9: statement;
is equivalent to:
case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: statement;
Comments
Post a Comment