fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int cond = 2;
  6. switch (cond) {
  7. case 0: case 1: { /* <- start scope */
  8. int i = 1;
  9. printf("case 1: %d\n", i);
  10. } break; /* <- end scope and jump to end of switch */
  11. case 2:
  12. printf("case 2: %d\n", i); /* i is recognized as unknown identifier */
  13. }
  14. return 0;
  15. }
  16.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:12:34: error: ‘i’ undeclared (first use in this function)
           printf("case 2: %d\n", i); /* i is recognized as unknown identifier */
                                  ^
prog.c:12:34: note: each undeclared identifier is reported only once for each function it appears in
stdout
Standard output is empty