strtok.c 452 B

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