fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int val = 0;
  5.  
  6. switch( val ) {
  7. case 0:
  8. int b = 8;
  9. break;
  10. case 2:
  11. int b = 4;
  12. break;
  13. }
  14.  
  15. return 0;
  16. }
  17.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'main':
prog.c:8:9: error: a label can only be part of a statement and a declaration is not a statement
         int b = 8;
         ^
prog.c:11:9: error: a label can only be part of a statement and a declaration is not a statement
         int b = 4;
         ^
prog.c:11:13: error: redefinition of 'b'
         int b = 4;
             ^
prog.c:8:13: note: previous definition of 'b' was here
         int b = 8;
             ^
prog.c:11:13: warning: unused variable 'b' [-Wunused-variable]
         int b = 4;
             ^
stdout
Standard output is empty