feat: added lst structure
This commit is contained in:
parent
f3377656e4
commit
3287cd402f
6 changed files with 93 additions and 0 deletions
22
srcs/lst/ft_lstpush.c
Normal file
22
srcs/lst/ft_lstpush.c
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue