Re: convert string to char*


[ Follow Ups ] [ Post Followup ] [ CS328 Message Board ] [ FAQ ]

Posted by kalpol on August 16, 2001 at 13:51:00:

In Reply to: convert string to char* posted by dunce on August 16, 2001 at 13:41:59:

: is there a special function to convert string to char* or is it possible to sort a string without converting?
: any help would be appreciated.

yeah, a string is just an array of chars, and a char* points to the first element in the array.

you can get any character out of the string by just using the subscript operator

string a = "CS328"

cout << a[2] prints 3


Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS328 Message Board ] [ FAQ ]