feat: added lst structure

This commit is contained in:
Zoëy Noort 2025-05-31 19:36:07 +02:00
parent f3377656e4
commit 3287cd402f
6 changed files with 93 additions and 0 deletions

23
srcs/lst/ft_lstpop.c Normal file
View file

@ -0,0 +1,23 @@
#include "libft.h"
t_list *ft_lstpop(t_list **lst)
{
t_list *current;
t_list *prev;
if (!lst || !*lst)
return NULL;
current = *lst;
if (current->next == NULL)
{
*lst = NULL;
return current;
}
while (current->next)
{
prev = current;
current = current->next;
}
prev->next = NULL;
return current;
}