25 lines
1 KiB
C
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);
|
|
}
|