libft/srcs/slist/ft_slist_push.c

24 lines
No EOL
369 B
C

#if USE_SLIST
#include "libft.h"
void ft_slist_push(t_slist **lst, t_slist *node)
{
t_slist *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;
}
#endif