ProgrammingHard

char s[] = "one two three"; int w = 0; for (char *t = strtok(s, " "); t; t = strtok(NULL, " ")) w++; printf("%d", w); What is printed?

  1. A. 4
  2. B. 3
  3. C. 5
  4. D. 2

Correct answer: B. 3

strtok skips the empty field between the two spaces, so the tokens are one, two and three.

More C Programming questions

Exams that ask this topic