fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. string s;
  7. s += '1';
  8. s += '\0';
  9. s += '2';
  10.  
  11. cout << s << endl;
  12. cout << "Length: " << s.length() << endl;
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
12
Length: 3