Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //warning: range expressions in switch statements are non-standard [-Wpedantic]
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc, char* argv[]) {
- int x = 5;
- switch (x){
- case 1 ... 10:
- printf ("x: %d is in between 1-10\n",x);
- break;
- default:
- printf ("x: %d is not in between 1-10\n",x);
- }
- switch (x){
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- printf ("x: %d is in between 1-5\n",x);
- break;
- default:
- printf ("x: %d is not in between 1-5\n",x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement