42-archive/42-piscine-c/d10/ex05/ft_is_sort.c
2016-08-25 20:50:28 +02:00

25 lines
1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_sort.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/08/12 13:26:09 by jhalford #+# #+# */
/* Updated: 2016/08/12 13:26:24 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_sort(int *tab, int length, int (*f)(int, int))
{
int i;
i = 0;
while ((i + 1) < length)
{
if (f(tab[i + 1], tab[i]) < 0)
return (0);
i++;
}
return (1);
}