fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. const int * ptr;
  6. int x = 5;
  7. ptr = &x;
  8. *ptr = 3;
  9. return 0;
  10. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:8:7: error: assignment of read-only location '* ptr'
  *ptr = 3;
       ^
stdout
Standard output is empty