fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. const int x; //This causes an error
  6.  
  7. const int y = 0;
  8.  
  9. std::cout << "the value of y is " << y << std::endl;
  10.  
  11. y = 5; //This also causes an error
  12.  
  13. return 0;
  14. }
Compilation error #stdin compilation error #stdout 0s 15232KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:5:12: error: uninitialized const ‘x’ [-fpermissive]
  const int x; //This causes an error
            ^
prog.cpp:11:6: error: assignment of read-only variable ‘y’
  y = 5; //This also causes an error
      ^
stdout
Standard output is empty