/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strcmp.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: whaffman +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/07 14:39:41 by whaffman #+# #+# */ /* Updated: 2024/06/10 15:50:16 by whaffman ### ########.fr */ /* */ /* ************************************************************************** */ #include #include int ft_strcmp(char *s1, char *s2) { while (*s1 && *s1 == *s2) { s1++; s2++; } return (*s1 - *s2); } #ifdef DEBUG void test(char *s1, char *s2) { printf("s1: \"%s\"\ns2: \"%s\"\nft_strcmp: %d\nstrcmp: %d\n", \ s1, s2, ft_strcmp(s1, s2), strcmp(s1, s2)); } int main(void) { test("abc", "abc"); test("ab", "abc"); test("abc", "ab"); test("abd", "abc"); test("abc", "abd"); return (0); } #endif