String tokenizer function doubt

why do we use a pointer while calling string tokenizer function. whereas we call other functions normally ???

hey @chahatkumar, this is declaration of strtok function
char * strtok ( char * str, const char * delimiters );

You can clearly see that return type of this function is pointer, so it will return pointer only. Thatswhy we used pointer here.

okay
but my question is that why the return type has to be pointer ??
can we use simply char as return type ??

hey @chahatkumar, this is predefined function in c++ library, so we cannot change this.

okay thanks :slight_smile:

hey @chahatkumar if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved

1 Like