libft/srcs/lst/ft_lstpush.c

22 lines
343 B
C

#include "libft.h"
void ft_lstpush(t_list **lst, t_list *node)
{
t_list *current;
if (!lst || !node)
return;
node->next = NULL;
if (*lst == NULL)
{
*lst = node;
return;
}
current = *lst;
while (current->next != NULL)
current = current->next;
current->next = node;
}