-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lstadd_back_bonus.c
More file actions
47 lines (42 loc) · 1.44 KB
/
ft_lstadd_back_bonus.c
File metadata and controls
47 lines (42 loc) · 1.44 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_back_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thlibers <thlibers@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/20 16:01:12 by thlibers #+# #+# */
/* Updated: 2025/10/22 10:59:26 by thlibers ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstadd_back(t_list **lst, t_list *new)
{
t_list *tmp;
if (*lst == NULL)
{
*lst = new;
return ;
}
tmp = ft_lstlast(*lst);
tmp->next = new;
}
// int main()
// {
// t_list *lst = NULL;
// t_list *node1;
// t_list *node2;
// t_list *node3;
// node1 = ft_lstnew("bien");
// node2 = ft_lstnew("cava");
// node3 = ft_lstnew("salut");
// ft_lstadd_back(&lst, node1);
// ft_lstadd_back(&lst, node2);
// ft_lstadd_back(&lst, node3);
// while(lst)
// {
// printf("%s\n", (char *)lst->content);
// lst = lst->next;
// }
// return (0);
// }