make string from char c++ code example
Example 1: c++ char to string
#include <iostream>
using namespace std;
int main()
{
char c = 'l';
string str;
str.push_back(c);
}
Example 2: why convert char* to string c++
char *cStr = "C++";
std::string Str = std::string(cStr);