-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils_rotate.c
More file actions
48 lines (42 loc) · 1.44 KB
/
utils_rotate.c
File metadata and controls
48 lines (42 loc) · 1.44 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils_rotate.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: uyilmaz <uyilmaz@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/27 10:03:37 by uyilmaz #+# #+# */
/* Updated: 2023/02/27 17:53:08 by uyilmaz ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void ra(t_list **stack_a)
{
t_list *temp_a;
t_list *last;
temp_a = *stack_a;
*stack_a = (*stack_a)->next;
last = *stack_a;
while ((last)->next)
last = (last)->next;
(last)->next = temp_a;
(last)->next->next = NULL;
}
void rb(t_list **stack_b)
{
t_list *temp_b;
t_list *last;
temp_b = *stack_b;
*stack_b = (*stack_b)->next;
last = *stack_b;
while ((last)->next)
last = (last)->next;
(last)->next = temp_b;
(last)->next->next = NULL;
}
void rr(t_list **stack_a, t_list **stack_b)
{
ra(stack_a);
rb(stack_b);
ft_putstr("rr\n");
}