ca parait bon

This commit is contained in:
Camille Chauvet
2023-01-23 14:13:48 +01:00
parent cdc4eb5d5f
commit 3b80be7c0f
78 changed files with 9 additions and 6 deletions

View File

@ -35,7 +35,7 @@ int ft_is_finished(int *tab, size_t len)
size_t i;
unsigned long sum;
if (len >= sizeof(char) * 8 && len % sizeof(char) * 8 == 0)
if (len >= sizeof(char) * 8 && (len % (sizeof(char) * 8)) == 0)
{
sum = 0;
i = len - sizeof(char) * 8;
@ -55,19 +55,22 @@ void handler(int num)
static size_t len = 0;
char *str;
tab = ft_realloc(tab, len, len + 1, sizeof(int));
tab = ft_realloc(tab, len, len + 2, sizeof(int));
if (tab == NULL)
return ;
if (len == 0)
tab[0] = num;
else
tab[len] = num == tab[0];
ft_printf("tab[%d] = %d\n", len, tab[len]);
len++;
if (ft_is_finished(tab + 1, len - 1))
{
str = ft_tab_int_to_str(tab + 1, len - 1);
free(tab);
ft_printf("%s\n", str);
str = NULL;
free(str);
tab = NULL;
len = 0;
}
}

Binary file not shown.