String 03 - Tokenization

string s = “Today is Monday”
char* ptr = strtok(s, " ")
cout<<ptr<<endl;

why the output is value i.e., “Today” why not address is printed?

@a19JE0093 hi,strtok will return string and ptr point to that string so just like string if you want to print that you just write cout s,also pointer points to first element so it will print string.

@a19JE0093 for char* as there is a special overload in operator<< . If you want the address then use: static_cast<const void *>(&c);

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.