blob: caf6ec165944b5ee55919782b30f0ef8bc63ed86 (
plain)
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
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstreverse_ret.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/15 12:51:15 by cacharle #+# #+# */
/* Updated: 2020/01/18 11:52:50 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstreverse_ret(t_list *lst)
{
t_list *tmp;
if (lst == NULL)
return (NULL);
if (lst->next == NULL)
return (lst);
tmp = ft_lstreverse_ret(lst->next);
lst->next->next = lst;
lst->next = NULL;
return (tmp);
}
|