c++ - Get a char from a pointer to a string -
hello trying write function converts string lowercase using pointer instead of return value.
void makelowercase(std::string* in){ //for loop tolower(char *in);} but have no idea how each char out of pointer use tolower() with, or how how many chars in string
*in.length() and
sizeof(*in)/sizeof(char) don't work it. former error on use of pointer, latter same return value sizeof(*in) don't know how end loop.
c++ has shortcut member of object pointed pointer:
in->length() for accessing characters, use parentheses:
(*in)[i]
Comments
Post a Comment