To iterate over the str string that I used:
for (tok = strtok(str, ";"); tok && *tok; tok = strtok(NULL, ";")) {
I would like to understand how this cycle works. I think:
(1) tok = strtok(str, ";"); //initialization of tok with the first token in str (2) tok = strtok(NULL, ";"); // go to the next token in str? how does this work? (3) tok && *tok; //this stops the loop when tok =NULL or *tok=NULL
I would be grateful for your help!
source share