mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Merge pull request #1872 from luehm/c_cases
[C/en] Added tidbit about fall-though in switch statements.
This commit is contained in:
commit
6eeb1f962e
@ -313,6 +313,12 @@ int main (int argc, char** argv)
|
||||
case 1:
|
||||
printf("Huh, 'a' equals 1!\n");
|
||||
break;
|
||||
// Be careful - without a "break", execution continues until the
|
||||
// next "break" is reached.
|
||||
case 3:
|
||||
case 4:
|
||||
printf("Look at that.. 'a' is either 3, or 4\n");
|
||||
break;
|
||||
default:
|
||||
// if `some_integral_expression` didn't match any of the labels
|
||||
fputs("error!\n", stderr);
|
||||
|
Loading…
Reference in New Issue
Block a user