Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created Aug 2, 2019
Embed
What would you like to do?
#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