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

28 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_sorted.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/29 14:41:08 by cchauvet #+# #+# */
/* Updated: 2022/12/06 13:30:52 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "pushswap.h"
int ft_is_sorted(unsigned int *tab)
{
int i;
i = 1;
while (tab[i] != STOP_VALUE)
{
if (tab[i] != tab[i - 1] + 1)
return (0);
i++;
}
return (1);
}