hewow owo
added header, libft and all basic interactions with stack
This commit is contained in:
36
srcs/ps_rot.c
Normal file
36
srcs/ps_rot.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ps_rot.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/02/21 16:07:55 by tmaze #+# #+# */
|
||||
/* Updated: 2019/02/21 16:26:22 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
|
||||
void ps_rot(t_stack **s)
|
||||
{
|
||||
t_stack *tmp;
|
||||
t_stack *ind;
|
||||
|
||||
if (*s != NULL && ps_stksize(*s) > 2)
|
||||
{
|
||||
tmp = ps_stkpop(s);
|
||||
ind = *s;
|
||||
while (ind->next != NULL)
|
||||
ind = ind->next;
|
||||
ind->next = tmp;
|
||||
}
|
||||
else if (*s != NULL && ps_stksize(*s) == 2)
|
||||
ps_swap(s);
|
||||
}
|
||||
|
||||
void ps_rrot(t_stack **a, t_stack **b)
|
||||
{
|
||||
ps_rot(a);
|
||||
ps_rot(b);
|
||||
}
|
Reference in New Issue
Block a user