fix loop list

This commit is contained in:
David Gailleton
2025-11-11 15:29:28 +01:00
parent 03ea9975eb
commit a3e7a3d556
3 changed files with 26 additions and 7 deletions

View File

@@ -6,7 +6,7 @@
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/11/09 14:36:17 by dgaillet #+# #+# */
/* Updated: 2025/11/10 18:18:46 by dgaillet ### ########lyon.fr */
/* Updated: 2025/11/11 15:26:21 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */
@@ -14,6 +14,19 @@
void ft_lstadd_front(t_list **lst, t_list *new)
{
if (!new || !lst)
return ;
new->next = *lst;
*lst = new;
}
int main(void)
{
t_list *ptr;
t_list *lst[1];
ptr = ft_lstnew(NULL);
lst[0] = NULL;
ft_lstadd_front(lst, ptr);
free(ptr);
}