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

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -