libft/src/string/ft_strcmp.c
2024-12-02 16:29:49 +01:00

24 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: o_ :::::: ::: */
/* ft_strcmp.c :+: / :+::+: :+: */
/* +:+ > +:++:+ +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#++#++:++#++ */
/* +#+ +#+#+ +#++#+ +#+ \o/ */
/* Created: 2024/11/24 20:06:19 by whaffman #+#+# #+#+# #+# #+# | */
/* Updated: 2024/11/24 20:07:08 by whaffman ### ### ### ### / \ */
/* */
/* ************************************************************************** */
#include <stddef.h>
int ft_strcmp(const char *s1, const char *s2)
{
size_t i;
i = 0;
while (s1[i] && s2[i] && s1[i] == s2[i])
i++;
return ((unsigned char)s1[i] - (unsigned char)s2[i]);
}