-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.c
31 lines (27 loc) · 1.18 KB
/
init.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ioulkhir <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/06 16:17:43 by ioulkhir #+# #+# */
/* Updated: 2025/01/06 16:18:10 by ioulkhir ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
t_mystack *init_stack(int ac, char **av)
{
int i;
t_mystack *head;
t_mystack *tail;
i = 1; // ignore the program name
head = NULL;
while (i < ac)
{
tail = append_stack(&head, tail, atoi(av[i++]));
if (tail == NULL)
return (free_stack(&head), NULL);
}
return (head);
}