you can't convert a string to a char. A string is a group of char. You can convert each char in the string into a separate, independent char if you wish:

char boo[3] = "pi";
char first;
char second;
char third;

boo is a string containg three char, two visible char (p and i) and one invsible (terminating null char).

first = boo[0];
second = boo[1];
third = boo[2];

This converts each char in boo to separate independent char types that can be used however you like, (you could have used the the left hand side representation any place you use the right hand representation too, but what the ----).

07-04-2002

Dual-Catfish

Quote:

char boo[3] = "pi";
char first;
char second;
char third;

boo is a string containg three char, two visible char (p and i) and one invsible (terminating null char).

Boo is a character array holding 4 elements, 0-3. In this instance, the second and third characters hold a null terminator. Elements zero and one hold "pi";

everything would be fine. boo in initialized to a static string, whereas blah is a string assembled by assigning a single char at a time to a char array. Without the null char (aka, '\0' or just 0 which is zero, not capital oh) you don't have a string, you just have a char array.