fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(int argc, char** argv) {
  5. switch(argc) {
  6. case 0:
  7. int j = 0;
  8. std::cerr << "j: " << j << "\n";
  9. break;
  10. case 1:
  11. int k = 1;
  12. std::cerr << "k: " << k << "\n";
  13. break;
  14. default:
  15. std::cerr << "Empty.\n";
  16. }
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main(int, char**)':
prog.cpp:10:8: error: jump to case label [-fpermissive]
   case 1:
        ^
prog.cpp:7:7: note:   crosses initialization of 'int j'
   int j = 0;
       ^
prog.cpp:14:3: error: jump to case label [-fpermissive]
   default:
   ^
prog.cpp:11:7: note:   crosses initialization of 'int k'
   int k = 1;
       ^
prog.cpp:7:7: note:   crosses initialization of 'int j'
   int j = 0;
       ^
stdout
Standard output is empty