-
Notifications
You must be signed in to change notification settings - Fork 12
/
ft_lstadd_back.c
36 lines (32 loc) · 1.2 KB
/
ft_lstadd_back.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
34
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_back.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apuchill <apuchill@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/07 15:54:09 by apuchill #+# #+# */
/* Updated: 2020/02/19 14:03:55 by apuchill ### ########.fr */
/* */
/* ************************************************************************** */
/*
** LIBRARY: N/A
** SYNOPSIS: add new element at end of list
**
** DESCRIPTION:
** Adds the element ’new’ at the end of the list.
*/
#include "libft.h"
void ft_lstadd_back(t_list **lst, t_list *new)
{
t_list *aux;
if (!new)
return ;
if (!*lst)
{
*lst = new;
return ;
}
aux = ft_lstlast(*lst);
aux->next = new;
}