-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstaddback.c
33 lines (30 loc) · 1.14 KB
/
ft_lstaddback.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstaddback.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jraymond <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/03/27 17:11:42 by jraymond #+# #+# */
/* Updated: 2018/06/28 17:13:13 by jraymond ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstaddback(t_list **begin_lst, t_list *new)
{
t_list *elem;
if (!begin_lst)
return ;
if (!*begin_lst)
*begin_lst = new;
else
{
elem = *begin_lst;
if (new)
{
while (elem->next)
elem = elem->next;
}
elem->next = new;
}
}