-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrotate.c
More file actions
32 lines (29 loc) · 1.15 KB
/
rotate.c
File metadata and controls
32 lines (29 loc) · 1.15 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
/* ************************************************************************** */
/* */
/* :::::::: */
/* rotate.c :+: :+: */
/* +:+ */
/* By: lorenasmienk <lorenasmienk@student.coda +#+ */
/* +#+ */
/* Created: 2019/12/26 12:35:57 by lorenasmien #+# #+# */
/* Updated: 2019/12/27 14:43:10 by lsmienk ######## odam.nl */
/* */
/* ************************************************************************** */
#include "push_swap.h"
void rotate(t_stack *ar, char x)
{
int temp;
int i;
temp = ar->stack[ar->len - 1];
i = ar->len;
while (i > 0)
{
ar->stack[i - 1] = ar->stack[i - 2];
i--;
}
ar->stack[i] = temp;
if (x == 'a')
ft_printf("ra\n");
if (x == 'b')
ft_printf("rb\n");
}