Significance of pointer

can’t we just declare ptr as a char instead of char*? if not why? and what is the significance of using pointer(char*) here?
Vidname-tokenization using strtok

@akash27,

  • Because a char and a pointer to char are two different data types, and thus need to be declared differently.

  • Here, we use char pointer to point to an char array returned by the strtok() function.

can you please explain the program’s control flow with help of a dry run? it would be much appreciated :blush:

@akash27,
Theres nothing to dry run, we are just calling a STL function, it returns a char pointer, we receive it in another char pointer ptr and then print the char array.
If you want to see, how the strtok() function itself works, there is a video on its implementation, please refer to that.

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.