Files
42_INT_01_libft/srcs/ft_issort.c
2020-02-10 10:25:04 +01:00

27 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_issort.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/16 15:18:14 by hulamy #+# #+# */
/* Updated: 2018/11/16 15:18:15 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_issort(int *tab, int length, int (*f)(int, int))
{
int i;
i = -1;
if (!tab)
return (0);
while (++i < length - 1)
if (f(tab[i], tab[i + 1]) > 0)
return (0);
return (1);
}