2022-11-23 15:44:27 -05:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* ft_p.c :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2022/11/09 16:38:34 by cchauvet #+# #+# */
|
2022-11-29 08:06:22 -05:00
|
|
|
/* Updated: 2022/11/28 18:15:41 by cchauvet ### ########.fr */
|
2022-11-23 15:44:27 -05:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "pushswap.h"
|
|
|
|
|
|
|
|
void ft_p(int *tab_src, int *tab_dst)
|
|
|
|
{
|
|
|
|
int size_src;
|
|
|
|
int size_dst;
|
|
|
|
|
2022-11-29 08:06:22 -05:00
|
|
|
size_src = ft_tablen(tab_src);
|
|
|
|
size_dst = ft_tablen(tab_dst);
|
|
|
|
if (size_src == 0)
|
2022-11-23 15:44:27 -05:00
|
|
|
return ;
|
2022-11-29 08:06:22 -05:00
|
|
|
tab_dst[size_dst] = tab_src[size_src - 1];
|
|
|
|
tab_dst[size_dst + 1] = -1;
|
|
|
|
tab_src[size_src - 1] = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ft_pb(int *tab_a, int *tab_b)
|
|
|
|
{
|
|
|
|
ft_p(tab_b, tab_a);
|
|
|
|
ft_putstr("pb");
|
|
|
|
}
|
|
|
|
|
|
|
|
void ft_pa(int *tab_a, int *tab_b)
|
|
|
|
{
|
|
|
|
ft_p(tab_a, tab_b);
|
|
|
|
ft_putstr("pa");
|
2022-11-23 15:44:27 -05:00
|
|
|
}
|