-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_cstrlen.c
30 lines (27 loc) · 1.08 KB
/
ft_cstrlen.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_cstrlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ohachim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/26 18:47:13 by ohachim #+# #+# */
/* Updated: 2019/05/26 05:43:12 by ohachim ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_cstrlen(const char *str, char c)
{
int cn;
int len;
len = 0;
cn = 0;
while (str[cn] != '\0' && str[cn] != c)
cn++;
while (str[cn] != '\0')
{
len++;
cn++;
}
return (len);
}