-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstswap.c
28 lines (25 loc) · 1.15 KB
/
ft_lstswap.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstswap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mfebvay <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/01/30 19:27:06 by mfebvay #+# #+# */
/* Updated: 2015/01/30 20:42:32 by mfebvay ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstswap(t_list **alst)
{
t_list *current;
t_list *tmp;
current = *alst;
if (!current || !current->next)
return (*alst);
tmp = current->next->next;
current->next->next = current;
*alst = current->next;
current->next = tmp;
return (*alst);
}