fork download
  1. #include <string>
  2.  
  3. int main(){
  4. std::string s1 = "foo";
  5. std::string s2 = s1[1];
  6. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:5: error: invalid conversion from ‘char’ to ‘const char*’
prog.cpp:5: error:   initializing argument 1 of ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’
stdout

Standard output is empty