assign char* to string c++ code example Example: why convert char* to string c++ char *cStr = "C++"; std::string Str = std::string(cStr);