super_lib_c/ft_printf/libft/ft_lstadd_back.c

31 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_back.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mdenys <mdenys@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/11/04 18:15:55 by mdenys #+# #+# */
/* Updated: 2020/11/04 18:36:49 by mdenys ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstadd_back(t_list **lst, t_list *new)
{
t_list *temp;
temp = *lst;
if (*lst)
{
while (temp->next != NULL)
temp = temp->next;
temp->next = new;
}
else if (*lst == NULL)
{
*lst = new;
}
}