Mise a jour

This commit is contained in:
Etienne Rey-bethbeder 2022-11-27 23:10:38 +01:00
parent 719b712dae
commit aa87242f7d

View file

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/23 16:48:12 by erey-bet #+# #+# */ /* Created: 2022/11/23 16:48:12 by erey-bet #+# #+# */
/* Updated: 2022/11/23 17:25:59 by erey-bet ### ########.fr */ /* Updated: 2022/11/27 23:10:27 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -15,31 +15,53 @@
#include <stdio.h> #include <stdio.h>
void push_swap(int *pa) void get_index(int *tab, int **index)
{
int i;
int min;
int new_index;
i = 0;
min = tab[0];
new_index = 0;
while (i < argc)
{ {
} }
}
void push_swap(int *tab, int argc)
{
int *index;
index = malloc(sizeof(int) * (argc + 1));
get_index(tab, &index);
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int *tab; int *tab;
int i; int i;
int y;
int test; int test;
tab = malloc(sizeof(int) * argc); tab = malloc(sizeof(int) * (argc + 1));
i = 0; i = 0;
y = 0;
if (argc > 1) if (argc > 1)
{ {
while (++i < argc) while (++i < argc)
{ {
if(ft_atoi_check(argv[i])) if(ft_atoi_check(argv[i]))
*tab++ = ft_atoi(argv[i]); tab[y++] = ft_atoi(argv[i]);
else else
{ {
write(1, "Error\n", 6); write(1, "Error\n", 6);
return (1); return (1);
} }
} }
tab[y] = NULL;
push_swap(tab, argc);
} }
return (0); return (0);