-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlen.c
47 lines (41 loc) · 1.59 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mbin-nas <mbin-nas@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 12:10:08 by mbin-nas #+# #+# */
/* Updated: 2022/07/27 15:07:01 by mbin-nas ### ########.fr */
/* */
/* ************************************************************************** */
/*
DESCRIPTION
The strlen() function computes the length of the string s.
The strnlen() function attempts to compute the length of s,
but never scans beyond the first maxlen bytes of s.
RETURN VALUES
The strlen() function returns the number of characters that
precede the terminating NUL character.
The strnlen() function returns either the same result as
strlen() or maxlen, whichever is smaller.
*/
#include "libft.h"
#include <stdio.h>
#include <stdlib.h>
size_t ft_strlen(const char *c)
{
size_t l;
l = 0;
while (c[l] != '\0')
{
l++;
}
return (l);
}
// int main()
// {
// char myarray[] = "Welcome";
// printf ("The value of the string is : %zu\n", ft_strlen(myarray));
// return (0);
// }