#include <iostream>using namespace std; int main() { const int x; //This causes an error const int y = 0; std::cout << "the value of y is " << y << std::endl; y = 5; //This also causes an error return 0;}
Standard input is empty
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 ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!