Skip to content

Instantly share code, notes, and snippets.

@surinoel
Created July 27, 2019 05:56
Show Gist options
  • Select an option

  • Save surinoel/01e4f075f27fbc7bfe7803c3e496e657 to your computer and use it in GitHub Desktop.

Select an option

Save surinoel/01e4f075f27fbc7bfe7803c3e496e657 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
int main(void) {
char buf[30] = "1,2,3,4,5,6";
char *ptr = strtok(buf, ",");
while (ptr != NULL) {
printf("%s\n", ptr);
ptr = strtok(NULL, ",");
}
return 0;
}
#if 0
1
2
3
4
5
6
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment