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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -