fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void test() {
  5. string s1 = "foo";
  6. string s2 = "bar";
  7. string s = s1 + s2;
  8. const char* sp = s.c_str();
  9. delete sp;
  10. }
  11.  
  12. int main() {
  13. test();
  14. return 0;
  15. }
Runtime error #stdin #stdout #stderr 0s 3460KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
*** Error in `./prog': free(): invalid pointer: 0x08233a4c ***