libft/srcs/slist/ft_slist_reverse.c

19 lines
No EOL
295 B
C

#if USE_SLIST
#include "libft.h"
void ft_slist_reverse(t_slist **lst)
{
t_slist *prev = NULL;
t_slist *curr = *lst;
t_slist *next;
while (curr)
{
next = curr->next;
curr->next = prev;
prev = curr;
curr = next;
}
*lst = prev;
}
#endif