Created
October 26, 2018 17:14
-
-
Save gabyfle/07d5c0017286254856fd06709f4d1431 to your computer and use it in GitHub Desktop.
Implementation of C split() function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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