-
Notifications
You must be signed in to change notification settings - Fork 0
/
sa_swap_a.c
28 lines (25 loc) · 1.21 KB
/
sa_swap_a.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* sa_swap_a.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ael-khni <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/12 07:48:39 by ael-khni #+# #+# */
/* Updated: 2022/01/14 14:21:06 by ael-khni ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
/* sa: swap a - swap the first 2 elements at the top of stack a.
* (do nothing if there is only one or no elements). */
void sa_swap_a(t_stack *a, int flag)
{
int tmp;
if (is_empty(a))
return ;
tmp = a->top->data;
a->top->data = a->top->bellow->data;
a->top->bellow->data = tmp;
if (!flag)
ft_putstr("sa\n");
}