-
Notifications
You must be signed in to change notification settings - Fork 0
/
moves_rotr.c
51 lines (45 loc) · 1.35 KB
/
moves_rotr.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* moves_rotr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: issierra <issierra@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/20 08:24:19 by issierra #+# #+# */
/* Updated: 2023/12/24 08:54:28 by issierra ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void rrr(t_stack **a, t_stack**b)
{
rotr(a);
rotr(b);
ft_printf("rrr\n");
}
void rra(t_stack **ptr)
{
rotr(ptr);
ft_printf("rra\n");
}
void rrb(t_stack **ptr)
{
rotr(ptr);
ft_printf("rrb\n");
}
void rotr(t_stack **ptr)
{
t_stack *tmp;
t_stack *sec_last;
t_stack *head;
head = *ptr;
tmp = *ptr;
while (tmp && tmp->next)
{
sec_last = tmp;
tmp = tmp->next;
}
head = sec_last->next;
sec_last->next = NULL;
head->next = *ptr;
*ptr = head;
}