piscine/c11/ex04/ft_is_sort.c
Willem Haffmans 607ce08c18 all
2024-09-10 00:18:01 +02:00

26 lines
1.0 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_sort.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/23 12:37:52 by whaffman #+# #+# */
/* Updated: 2024/06/23 12:41:03 by whaffman ### ########.fr */
/* */
/* ************************************************************************** */
int ft_is_sort(int *tab, int length, int(*f)(int, int))
{
int i;
i = 0;
while (i < n - 1)
{
if (f(tab[i], tab[i + 1]) > 0)
return (0);
i++;
}
return (1);
}