hewow owo
added header, libft and all basic interactions with stack
This commit is contained in:
31
srcs/ps_swap.c
Normal file
31
srcs/ps_swap.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ps_swap.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/02/21 14:06:40 by tmaze #+# #+# */
|
||||
/* Updated: 2019/02/21 15:19:00 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
|
||||
void ps_swap(t_stack **s)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
if (*s != NULL && ps_stksize(*s) >= 2)
|
||||
{
|
||||
tmp = (*s)->nb;
|
||||
(*s)->nb = (*s)->next->nb;
|
||||
(*s)->next->nb = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
void ps_sswap(t_stack **a, t_stack **b)
|
||||
{
|
||||
ps_swap(a);
|
||||
ps_swap(b);
|
||||
}
|
Reference in New Issue
Block a user