32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_list_reverse.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/11/09 16:28:30 by gtertysh #+# #+# */
|
|
/* Updated: 2016/11/09 17:06:02 by gtertysh ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include <stdlib.h>
|
|
#include "ft_list.h"
|
|
|
|
void ft_list_reverse(t_list **begin_list)
|
|
{
|
|
t_list *prev;
|
|
t_list *next;
|
|
t_list *curr;
|
|
|
|
prev = NULL;
|
|
curr = *begin_list;
|
|
while (curr)
|
|
{
|
|
next = curr->next;
|
|
curr->next = prev;
|
|
prev = curr;
|
|
curr = next;
|
|
}
|
|
*begin_list = prev;
|
|
}
|