convert array char to string 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: c++ string to char array
const char *array = tmp.c_str(); //For const char array
char *array = &tmp[0]; // If you need to modify the array