Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 2, 2019 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/0c0c911c7274c40c82f2d12bb9cee54b to your computer and use it in GitHub Desktop.
Save parzibyte/0c0c911c7274c40c82f2d12bb9cee54b to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
int main(){
char cadena[] = "Hola,mundo,soy,una,cadena,separa,por,comas",
delimitador[] = ",";
char *token = strtok(cadena, delimitador);
if(token != NULL){
while(token != NULL){
// Sólo en la primera pasamos la cadena; en las siguientes pasamos NULL
printf("Token: %s\n", token);
token = strtok(NULL, delimitador);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment