42_push_swap/main.c
Camille Chauvet bb6e9ddd85 d
2022-11-23 21:44:27 +01:00

37 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/09 17:10:47 by cchauvet #+# #+# */
/* Updated: 2022/11/09 17:12:25 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "pushswap.h"
int main(int argc, char *argv[])
{
int i;
int *tab_a;
tab_a = malloc(argc * sizeof(int));
if (tab_a == NULL)
return (1);
i = 0;
while (i + 1 < argc)
{
if (!ft_isnum(argv[i + 1]))
{
ft_putstr("Erreur: args doesn't containe only numbers !");
return (1);
}
tab_a[i] = ft_atoi(argv[i + 1]);
i++;
}
ft_sort(tab_a, i);
return (0);
}