blob: c115ac551c4820d6b8ae0f0d1e8f30800704a789 (
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
28
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstreverse_ret.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/15 12:51:15 by cacharle #+# #+# */
/* Updated: 2020/02/10 02:20:21 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "libft_lst.h"
t_ftlst *ft_lstreverse_ret(t_ftlst *lst)
{
t_ftlst *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);
}
|