-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strcount.c
More file actions
31 lines (28 loc) · 1.05 KB
/
ft_strcount.c
File metadata and controls
31 lines (28 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strcount.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ppanchen <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/02 14:00:28 by ppanchen #+# #+# */
/* Updated: 2016/12/02 14:10:13 by ppanchen ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strcount(char const *s)
{
int i;
int j;
i = 0;
j = 1;
if (!s)
return (0);
while (s[i])
{
if (s[i] == '\n')
j++;
i++;
}
return (j);
}