libft
ft_strcchr.c
Go to the documentation of this file.
1 /* ************************************************************************** */
3 /* */
4 /* ::: :::::::: */
5 /* ft_strcchr.c :+: :+: :+: */
6 /* +:+ +:+ +:+ */
7 /* By: unite <marvin@42.fr> +#+ +:+ +#+ */
8 /* +#+#+#+#+#+ +#+ */
9 /* Created: 2019/09/28 22:34:13 by unite #+# #+# */
10 /* Updated: 2020/07/16 02:51:21 by unite ### ########.fr */
11 /* */
12 /* ************************************************************************** */
13 
14 #include "libft.h"
15 
23 int ft_strcchr(char const *str, char c)
24 {
25  int count;
26 
27  count = 0;
28  if (!str || !c)
29  return (-1);
30  while (*str)
31  {
32  if (*str == c)
33  count++;
34  str++;
35  }
36  return (count);
37 }
ft_strcchr
int ft_strcchr(char const *str, char c)
Counts the number of occurrences of a character in a string.
Definition: ft_strcchr.c:23
libft.h