Why is He Doing THis? Can Someone Explain me this?

char* s = strtok((char*)str.c_str(), " ");

strtok works only for C style string ie. an array of characters.
So using (char*)str.c_str() we convert the input string to C style string (ie. array of characters )

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.