27 lines
1.1 KiB
C
27 lines
1.1 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_lstadd_back.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2022/09/29 23:58:34 by cchauvet #+# #+# */
|
||
|
/* Updated: 2022/10/26 18:06:00 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "libft.h"
|
||
|
|
||
|
void ft_lstadd_back(t_list **lst, t_list *new)
|
||
|
{
|
||
|
t_list *last;
|
||
|
|
||
|
if (lst == NULL || new == NULL)
|
||
|
return ;
|
||
|
last = ft_lstlast(*lst);
|
||
|
if (last == NULL)
|
||
|
*lst = new;
|
||
|
else
|
||
|
last->next = new;
|
||
|
}
|