fork(13) download
  1. #include <iostream>
  2. #include <cstring>
  3. #include <string>
  4.  
  5. int main() {
  6. std::string str = "Hello, world!";
  7. str[5] = 0;
  8. std::cout << "string says its length is: " << str.length() << std::endl;
  9. std::cout << "strlen says: " << strlen(str.c_str()) << std::endl;
  10. return 0;
  11. }
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
string says its length is: 13
strlen says: 5