const char to string
const char * s = "hello"; std::string str(s);
Here is what the above code is Doing:
1. We create a string literal “hello” and store it in a pointer s.
2. We create a string object str and initialize it with the string literal “hello”.
3. We create a string object str2 and initialize it with the string object str.
4. We create a string object str3 and initialize it with the string literal “hello”.