-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlen.c
48 lines (40 loc) · 1.49 KB
/
ft_strlen.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sperez-p <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/20 12:43:56 by sperez-p #+# #+# */
/* Updated: 2021/09/06 17:26:11 by sperez-p ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
NAME
****
ft_strlen ---> calculate the length of a string
SYNOPSIS
********
#include "mylibft.h"
size_t ft_strlen(const char *str);
PARAMETERS
**********
str ---> the string whose length is to be found
DESCRIPTION
***********
The ft_strlen() function calculates the length of 'str', excluiding the
terminating null byte '\0'. If the content of 'str' if NULL, returns zero.
RETURN VALUE
************
- The number of bytes in 'str'.
- If 'str' is NULL, returns zero.
*/
size_t ft_strlen(const char *s)
{
size_t i;
i = 0;
while (s[i])
i++;
return (i);
}