28 lines
1.1 KiB
C
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);
|
|
}
|