-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_rev_rotate.c
More file actions
31 lines (29 loc) · 1020 Bytes
/
Copy pathft_rev_rotate.c
File metadata and controls
31 lines (29 loc) · 1020 Bytes
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_rev_rotate.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yelallam <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/02/17 13:28:20 by yelallam #+# #+# */
/* Updated: 2026/02/24 10:53:45 by yelallam ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void ft_rev_rotate(t_stack **head, char stack)
{
t_stack *last_node;
t_stack *copy;
if (*head == NULL || (*head)->next == NULL)
return ;
last_node = ft_lstlast(*head);
copy = *head;
while (copy -> next -> next != NULL)
copy = copy -> next;
copy -> next = NULL;
ft_lstadd_front(head, last_node);
if (stack == 'a')
write(1, "rra\n", 4);
if (stack == 'b')
write(1, "rrb\n", 4);
}