27 lines
1 KiB
C
27 lines
1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_count_if.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/08/12 13:25:42 by jhalford #+# #+# */
|
|
/* Updated: 2016/08/13 16:23:03 by jhalford ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
int ft_count_if(char **tab, int (*f)(char *))
|
|
{
|
|
int i;
|
|
int counter;
|
|
|
|
i = 0;
|
|
counter = 0;
|
|
while (tab[i])
|
|
{
|
|
if (f(tab[i]) == 1)
|
|
counter++;
|
|
i++;
|
|
}
|
|
return (counter);
|
|
}
|