-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstreverse.c
32 lines (29 loc) · 1.13 KB
/
ft_lstreverse.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstreverse.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: abkssiba <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/27 11:32:26 by abkssiba #+# #+# */
/* Updated: 2019/10/27 11:35:32 by abkssiba ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstreverse(t_list **begin_list)
{
t_list *curr;
t_list *prev;
t_list *next;
curr = *begin_list;
prev = 0;
next = 0;
while (curr)
{
next = curr->next;
curr->next = prev;
prev = curr;
curr = next;
}
*begin_list = prev;
}