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