-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strnlen.c
More file actions
27 lines (24 loc) · 1.05 KB
/
ft_strnlen.c
File metadata and controls
27 lines (24 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
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_strnlen.c :+: :+: */
/* +:+ */
/* By: nsterk <nsterk@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/12 21:16:10 by nsterk #+# #+# */
/* Updated: 2020/11/12 21:36:05 by nsterk ######## odam.nl */
/* */
/* ************************************************************************** */
#include <stdlib.h>
size_t ft_strnlen(const char *s, size_t maxlen)
{
size_t i;
i = 0;
while (i < maxlen)
{
if (s[i] == '\0')
return (i);
i++;
}
return (maxlen);
}