I have a member function in a class that returns a String. What do I need to do in the declaration if I want to make the return a C-string type? The revised function may or may not have a C-string argument(It is OK to remain the current argument).
The original declaration is :
string function(string argument);
C-style strings are
char
arrays closed with a\0
, so:You may also consider tor return a string and retrieve a C-string from that value via the
c_str()
method.