char to string

Hi Guys can anybody give me some easy and a helpful idea that how to convert char to string or vice verca,, Also make a program in which we convert a char into string please????????? CHAR ARRAY TO STRING

Conversion Char array to String
ALSO MAKE A PROGRAMME OF ARRAYS IN WHICH WE CHANGE CHAR TO STRINGS.......
Last edited on
char *hello_char="Hello";
std::sting hello_string(hello_char);

or
std::sting hello_string;
hello_string=hello_char;

The reverse:

std::string str = "string";
const char *cstr = str.c_str(); //note: returns a const
Please do not double post. I makes orum cluttered and difficult to search
http://www.cplusplus.com/forum/general/103071/
Topic archived. No new replies allowed.