2
0

strtok.c 464 B

1234567891011121314151617
  1. #include <string.h>
  2. #include <stdio.h>
  3. #include "test_helpers.h"
  4. int main(void) {
  5. char source[] = "I'd just like to interject for a moment. What you're referring to as Linux, "
  6. "is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux.\n";
  7. char* token = strtok(source, " ");
  8. while (token) {
  9. printf("%s", token);
  10. if ((token = strtok(NULL, " "))) {
  11. printf("_");
  12. }
  13. }
  14. }