Created
August 2, 2019 22:09
-
-
Save parzibyte/377c060ebb58ed312172be384b957ec2 to your computer and use it in GitHub Desktop.
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
/* | |
Ejemplo 3 de strtok en C | |
@author parzibyte | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
int main(){ | |
char cadena[] = "Hola\nMundo\t\t\tSeparado\nPor\nSaltos y tabulaciones", | |
delimitador[] = "\n\t"; | |
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