fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. const string s = "example";
  6. for (auto &e: s)
  7. e = 'X';
  8. return 0;
  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:5: error: assignment of read-only reference ‘e’
   e = 'X';
     ^
stdout
Standard output is empty