implement strtok
Anonymous
char * my_strtok(char * str, char *token) { static char *buffer; if(str != NULL) buffer = str; if(buffer == NULL) return NULL; char * res = buffer; char *b, *d; for (b = buffer; *b!= '\0'; b++) { for (b= token; *d != '\0'; d++){ if(*b==*d){ *b = '\0' b = b+1; // skip if the match is the start if(res == b){ res++; continue; } return res; } } } return res; }
Check out your Company Bowl for anonymous work chats.