Skip to content

Instantly share code, notes, and snippets.

@gabyfle
Created October 26, 2018 17:14
Show Gist options
  • Save gabyfle/07d5c0017286254856fd06709f4d1431 to your computer and use it in GitHub Desktop.
Save gabyfle/07d5c0017286254856fd06709f4d1431 to your computer and use it in GitHub Desktop.
Implementation of C split() function
short split(char string[], char * words[])
{
const char separators[] = ",; :";
char * token;
short i = 0;
token = strtok(string, separators);
while (token != NULL)
{
words[i] = token;
token = strtok(NULL, separators);
i++;
}
return i;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment