-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strnequ.c
28 lines (26 loc) · 1.13 KB
/
ft_strnequ.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strnequ.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dbrophy <dbrophy@student.42.us.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/19 12:52:45 by dbrophy #+# #+# */
/* Updated: 2020/02/19 12:52:45 by dbrophy ### ########.fr */
/* */
/* ************************************************************************** */
#include "stdlib.h"
#include "string.h"
int ft_strnequ(const char *s1, const char *s2, size_t limit)
{
if (s1 == NULL || s2 == NULL)
return (0);
while (*s1 != 0 && *s2 != 0 && limit-- > 0)
{
if (*s1 != *s2)
return (0);
s1++;
s2++;
}
return (1);
}