Files
M311-Principes-des-systemes…/2019-2020/S3T_TP_03_PROCESSUS-2-PROG/Demonstrations/demo_strtok.c
JunkJumper cf00c53e65 "debut TD0"
2020-09-04 10:27:13 +02:00

21 lines
398 B
C
Executable File

/// M311 - demonstration : gets, strtok
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
int main()
{
char *mot;
char *ligne = malloc (80);
ligne = fgets (ligne, 80, stdin);
printf("===%s===\n", ligne);
mot = strtok (ligne, " ");
while (mot != NULL)
{
printf("%s\n", mot);
mot = strtok (NULL, " ");
}
return 0;
}