Code before the first 'case' in a switch-statement
c, switch-statement
Solution
It can be useful to declare variables that have a scope limited to the `switch` block (but be aware that any initialisers for those variables will be skipped):
switch (...)
{
int n;
case 0:
...
}
In theory, you could also put code there that you get to using `goto`.
Problem
In C it's possible to write code before the first `case` label. Are there any cases for which it is useful to do this or is it just a 'dead block of code' ? E.g.: ``` switch (...) { { int a = 0x2a; printf("%d\n", a); } case 0: ... } ```