42_C_PISCINE/Rush/Rush01/input.c
Camille Chauvet 29ed24d567 init
2023-05-17 16:45:25 +00:00

40 lines
655 B
C

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
void ft_putchar(char c)
{
write(1, &c, 1);
}
int ft_input(char *str)
{
int i;
int counter;
int *tab;
i = 0;
counter = 1;
while (str[i] != 0)
{
if ('0' < str[i] && str[i] < '5')
counter++;
else
if (str[i] != ' ')
return (0);
i++;
}
i = 0;
tab = malloc(sizeof(tab) * counter);
counter = 0;
while (str[i] != 0)
{
if ('0' < str[i] && str[i] < '5')
{
tab[counter] = str[i] - '0';
counter++;
}
i++;
}
}