-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_strequ.c
39 lines (34 loc) · 1.26 KB
/
ft_strequ.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* strequ_main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jony <jony@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/29 13:05:28 by mhasan #+# #+# */
/* Updated: 2019/11/04 21:31:32 by jony ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strequ(char const *s1, char const *s2)
{
int i;
int res;
if (!s1 || !s2)
return (s1 == s2 ? 1 : 0);
i = 0;
while (s1[i] == s2[i] && s1[i] != '\0' && s2[i] != '\0')
i++;
res = s1[i] - s2[i];
if (res == 0)
return (1);
else
return (0);
}
int main(void)
{
char *str1 = "hello";
char *str2 = "hello";
printf("%d", ft_strequ(str1, str2));
return (0);
}