aboutsummaryrefslogtreecommitdiff
path: root/c11/ex03/ft_count_if.c
blob: a04fe390a10c2d43ae7a8da3132ec3faf8500b7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_count_if.c                                      :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <charles.cabergs@gmail.com>       +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2019/07/16 21:35:34 by cacharle          #+#    #+#             */
/*   Updated: 2019/07/18 11:01:46 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

int	ft_count_if(char **tab, int length, int (*f)(char*))
{
	int	counter;

	counter = 0;
	while (length-- > 0)
		if ((*f)(*tab++))
			counter++;
	return (counter);
}