42/d10/ex04/ft_count_if.c
2016-11-20 02:20:23 +02:00

28 lines
1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_count_if.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 17:54:32 by gtertysh #+# #+# */
/* Updated: 2016/11/07 18:17:50 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
int ft_count_if(char **tab, int (*f)(char *))
{
int count;
count = 0;
while(*tab)
{
if(f(*tab))
{
count++;
(*tab)++;
}
tab++;
}
return (count);
}