42_push_swap/ft_p.c
Camille Chauvet 3fc423de4a presque
2022-12-06 17:35:45 +01:00

40 lines
1.4 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_p.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/09 16:38:34 by cchauvet #+# #+# */
/* Updated: 2022/12/06 17:22:35 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "pushswap.h"
void ft_p(unsigned int *tab_src, unsigned int *tab_dst)
{
int size_src;
int size_dst;
size_src = ft_tablen(tab_src);
size_dst = ft_tablen(tab_dst);
if (size_src == 0)
return ;
tab_dst[size_dst] = tab_src[size_src - 1];
tab_dst[size_dst + 1] = -1;
tab_src[size_src - 1] = -1;
}
void ft_pb(unsigned int *tab_a, unsigned int *tab_b)
{
ft_p(tab_a, tab_b);
ft_putstr("pb\n");
}
void ft_pa(unsigned int *tab_a, unsigned int *tab_b)
{
ft_p(tab_b, tab_a);
ft_putstr("pa\n");
}