42_libft/ft_lstadd_back.c

27 lines
1.1 KiB
C
Raw Normal View History

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