42_push_swap/ft_r.c

38 lines
1.2 KiB
C
Raw Normal View History

2022-11-23 15:44:27 -05:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
2022-11-29 08:06:22 -05:00
/* ft_r.c :+: :+: :+: */
2022-11-23 15:44:27 -05:00
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
2022-11-29 08:06:22 -05:00
/* Created: 2022/11/28 16:50:03 by cchauvet #+# #+# */
2022-12-09 09:22:02 -05:00
/* Updated: 2022/12/09 14:36:50 by cchauvet ### ########.fr */
2022-11-23 15:44:27 -05:00
/* */
/* ************************************************************************** */
#include "pushswap.h"
2022-12-01 11:15:17 -05:00
static void ft_r(unsigned int *tab)
2022-11-23 15:44:27 -05:00
{
2022-11-29 08:06:22 -05:00
int i;
2022-11-23 15:44:27 -05:00
2022-11-29 08:06:22 -05:00
i = 0;
2022-12-01 11:15:17 -05:00
while (tab[i + 1] != STOP_VALUE)
2022-11-29 08:06:22 -05:00
{
2022-12-07 08:19:16 -05:00
ft_swap(tab + i + 1, tab + i);
2022-11-29 08:06:22 -05:00
i++;
}
2022-11-23 15:44:27 -05:00
}
2022-12-01 11:15:17 -05:00
void ft_ra(unsigned int *tab)
2022-11-23 15:44:27 -05:00
{
2022-11-29 08:06:22 -05:00
ft_r(tab);
2022-12-06 11:35:45 -05:00
ft_putstr("ra\n");
2022-11-23 15:44:27 -05:00
}
2022-12-09 09:22:02 -05:00
void ft_rb(unsigned int *tab)
{
ft_r(tab);
ft_putstr("rb\n");
}