fork(2) download
  1. int main()
  2. {
  3. int i = 42;
  4. int const *foo, *bar;
  5. foo = &i;
  6. bar = &i;
  7. *foo = 1; // error
  8. *bar = 2; // error
  9. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:7:10: error: assignment of read-only location ‘* foo’
     *foo = 1; // error
          ^
prog.cpp:8:10: error: assignment of read-only location ‘* bar’
     *bar = 2; // error
          ^
stdout
Standard output is empty