I'm very new to C, but I have a lot of experience with python, I have a project that I need to get 3 numbers on the same line and make a vector with these 3 numbers
in the input digit
3 1 37
I wanted you to form a vector [3,1,37] there is only one thing, the first one (in this case 3) can also be characters. something like
load 1 23 or delete 2 56
In python it would be extremely simple, it was just getting an input string and dps making an input = input.split ()
#include <stdio.h>
#include <string.h>C
int main ()
{
char entrada[31];
char * separado;
gets(entrada);
separado = strtok (entrada," ");
while (separado != NULL)
{
printf ("%s\n",separado);
separado = strtok (NULL, " ");
}
return 0;
}
I found this code in a forum gringo, someone knows if it has a simpler way or explain to me how it works? I did not understand