-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_countline.c
30 lines (27 loc) · 1.12 KB
/
ft_countline.c
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
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_countline.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: davfelix <[email protected]> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2018/11/08 11:53:11 by davfelix #+# ## ## #+# */
/* Updated: 2018/11/15 11:15:57 by davfelix ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
size_t ft_countline(char *str)
{
size_t nb;
nb = 1;
if (!*str)
return (0);
while (*str)
{
if (*str == '\n')
nb++;
str++;
}
return (nb);
}