-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrotate_top.c
27 lines (24 loc) · 1.13 KB
/
rotate_top.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_front.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: enoye <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/18 17:41:44 by enoye #+# #+# */
/* Updated: 2021/10/18 19:54:24 by enoye ### ########.fr */
/* */
/* ************************************************************************** */
#include "libpushswap.h"
void rotate_top(t_list **beijin)
{
t_list *tmp;
t_list *tmplast;
if (*beijin == 0 || (*beijin)-> next == 0)
return ;
tmp = *beijin;
*beijin = (*beijin)-> next;
tmplast = ft_lstlast(*beijin);
tmplast -> next = tmp;
tmp -> next = 0;
}