-
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.03 KB
/
ft_strnlen.c
File metadata and controls
27 lines (24 loc) · 1.03 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: rcappend <rcappend@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/15 10:11:12 by rcappend #+# #+# */
/* Updated: 2020/12/07 11:25:58 by rcappend ######## odam.nl */
/* */
/* ************************************************************************** */
#include <stddef.h>
size_t ft_strnlen(const char *s, size_t maxlen)
{
size_t i;
i = 0;
while (*s && maxlen > 0)
{
s++;
i++;
maxlen--;
}
return (i);
}