-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfill_stack_a.c
31 lines (28 loc) · 1.14 KB
/
fill_stack_a.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fill_stack_a.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: amtadevo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/22 16:57:39 by amtadevo #+# #+# */
/* Updated: 2022/11/22 16:57:41 by amtadevo ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
t_stack *fill_stack(char **str)
{
int i;
t_stack *top;
t_stack *num;
i = 0;
top = ft_lstnew(ft_atoi(str[i]));
top->pos = i;
while (str[++i])
{
num = ft_lstnew(ft_atoi(str[i]));
num->pos = i;
ft_lstadd_back(&top, num);
}
return (top);
}