diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-01-15 14:16:36 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-01-15 14:16:36 +0100 |
| commit | e8a7d07f1c99b5ce6210603d88098580af95fb13 (patch) | |
| tree | cd442d7e351c20bcc6a6dc9f0b4619100750932a /src/lst/ft_lstreverse_ret.c | |
| parent | 496afe8e8a82d6db730bf835eb5fbe1ef3a142be (diff) | |
| download | libft-e8a7d07f1c99b5ce6210603d88098580af95fb13.tar.gz libft-e8a7d07f1c99b5ce6210603d88098580af95fb13.tar.bz2 libft-e8a7d07f1c99b5ce6210603d88098580af95fb13.zip | |
Fix strtol, Added list reverse functions
Diffstat (limited to 'src/lst/ft_lstreverse_ret.c')
| -rw-r--r-- | src/lst/ft_lstreverse_ret.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lst/ft_lstreverse_ret.c b/src/lst/ft_lstreverse_ret.c new file mode 100644 index 0000000..03ae98e --- /dev/null +++ b/src/lst/ft_lstreverse_ret.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstreverse_ret.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/15 12:51:15 by cacharle #+# #+# */ +/* Updated: 2020/01/15 13:36:46 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); +} |
