-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
35 lines (32 loc) · 1.3 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nkawaguc <nkawaguc@student.42tokyo.jp> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/14 13:48:22 by nkawaguc #+# #+# */
/* Updated: 2024/10/14 14:48:56 by nkawaguc ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int main(int argc, char **argv)
{
int i;
int *input_array;
if (is_empty_array(argc))
return (SUCCESS);
i = 0;
while (++i < argc)
if (!is_valid_string(argv[i]))
error();
input_array = (int *)malloc(sizeof(int) * (argc - 1));
if (input_array == NULL)
error();
i = 0;
while (++i < argc)
input_array[i - 1] = ft_atoi(argv[i]);
push_swap(input_array, argc - 1);
free(input_array);
return (SUCCESS);
}