// Pass the string to be tokenized and get the first token.
tok = strtok(str, delims);
// Get all remaining tokens.
while(tok) {
cout << tok << endl;
// Each subsequent call to strtok() is passed NULL
// for the first argument.
tok = strtok(NULL, delims);
}
Maybe it's an effect of returning by reference, but I still don't understand.
tok = strtok(str, delims);
tok = strtok(NULL, delims);
How can strtok knows that NULL means to continue in the str string ?
2. The static token is declared inside the function and will have effect if we use again,means that token can't get deleted and is unchanged and usable next time ?