28 lines
1.1 KiB
C
28 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_lstadd_back.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: lfirmin <lfirmin@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/06/01 02:01:18 by lfirmin #+# #+# */
|
|
/* Updated: 2024/06/03 15:59:33 by lfirmin ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#include "libft.h"
|
|
|
|
void ft_lstadd_back(t_list **lst, t_list *new)
|
|
{
|
|
t_list *last;
|
|
|
|
if (!new)
|
|
return ;
|
|
if (!lst || !*lst)
|
|
{
|
|
*lst = new;
|
|
return ;
|
|
}
|
|
last = ft_lstlast(*lst);
|
|
last->next = new;
|
|
}
|