What str.c_str() does?

what str.c_str() does and it convert the string to the null-terminated character array and return the pointer of the character array then why we typecast it to (char *)?

hello @kkunalguptaaa
c_str function converts c++ string to const char * but strtok wants char * ,that is why we are explicitly typecasting const char * to char *

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.