Is there any problem in below code? #include <string> #include <iostream> void println_cstr(const char *text){ std::cout<<text<<std::endl; } void println_string(const std::string &text){ std::cout<<text<<std::endl; } int main(int argc, char **argv){ const char *s_cstr = "This is a C string"; std::string s_cpp("This is a C++ string"); println_cstr(s_cpp); println_string(s_cstr); return 0; }
Can not convert a std::string to const char *