fork download
  1. #include <iostream> /* C++ iostream C++98/11 */
  2. #include <string> /* C++ strings C++98/11 */
  3. // #include <boost/regex.hpp> /* RegEx Boost */
  4. //#include <boost/algorithm/string/replace.hpp>
  5. #include <cassert>
  6. #include <cstring>
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11.  
  12. string s;
  13. s.push_back('a');
  14. s.push_back('\0');
  15. s.push_back('a');
  16. // assert(s.length() == 3);
  17. // cout<<s.c_str()<<endl;
  18. cout<<s.data()<<endl;
  19. // const char* p = s.c_str();
  20. // cout<<strlen(p)<<endl;
  21. }
  22.  
Success #stdin #stdout 0.01s 5300KB
stdin
Standard input is empty
stdout
a