In the code, after the first token gets extracted then input variable is assigned as NULL. and it is static so during the second run when input is already null then why it’s not coming out of the function.
Designing String Tokenizer
Hello @ashwani225,
As you have said that input variable is static that means it will be declared and initialized only once i.e.
for the very first execution of the code.
But, whatever changes you will make to it’s value will be reflected in the subsequent function calls.
So, input won’t be NULL in the second run. It must be pointing to the starting character of the next token that needs to be extracted from the string passed in the first run.
Hope, this would help.
Give a like if you are satisfied.
1 Like