-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lstadd_back.c
More file actions
29 lines (27 loc) · 940 Bytes
/
Copy pathft_lstadd_back.c
File metadata and controls
29 lines (27 loc) · 940 Bytes
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_back.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yelallam <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/02/17 13:20:57 by yelallam #+# #+# */
/* Updated: 2026/02/24 11:28:47 by yelallam ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void ft_lstadd_back(t_stack **head, t_stack *new_node)
{
t_stack *saved_head;
if (*head == NULL)
{
*head = new_node;
new_node -> next = NULL;
return ;
}
saved_head = *head;
while (saved_head -> next != NULL)
saved_head = saved_head -> next;
saved_head -> next = new_node;
new_node -> next = NULL;
}