-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_chrcount.c
executable file
·23 lines (21 loc) · 1.03 KB
/
ft_chrcount.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_chrcount.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akharrou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/19 15:14:37 by akharrou #+# #+# */
/* Updated: 2019/04/15 04:41:28 by akharrou ### ########.fr */
/* */
/* ************************************************************************** */
int ft_chrcount(const char *s, const char c)
{
int char_count;
char_count = 0;
if (s)
while (*s)
if (*s++ == c)
++char_count;
return (char_count);
}