feat: added more lst functionality
This commit is contained in:
parent
2708a86b5f
commit
0863951787
7 changed files with 100 additions and 0 deletions
17
srcs/lst/ft_lstreverse.c
Normal file
17
srcs/lst/ft_lstreverse.c
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include "libft.h"
|
||||
|
||||
void ft_lstreverse(t_list **lst)
|
||||
{
|
||||
t_list *prev = NULL;
|
||||
t_list *curr = *lst;
|
||||
t_list *next;
|
||||
|
||||
while (curr)
|
||||
{
|
||||
next = curr->next;
|
||||
curr->next = prev;
|
||||
prev = curr;
|
||||
curr = next;
|
||||
}
|
||||
*lst = prev;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue