blob: 9dfa39d5b6159383ee426eb815d815261f1cd3de (
plain)
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
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnlen.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: joelecle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/14 17:07:14 by joelecle #+# #+# */
/* Updated: 2020/02/14 17:07:14 by joelecle ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include <stddef.h>
size_t
ft_strnlen(const char *s, size_t size)
{
const char *ptr = s;
while (size > 0 && *ptr)
{
size--;
ptr++;
}
return (ptr - s);
}
|