#include <stdio.h>
int ft_strcmp(const char *s1, const char *s2) {
while (*s1 && *s1 == *s2) {
s1++;
s2++;
}
return *s1 - *s2;
}
int main() {
char *str1 = "coucou";
char *str2 = "bonjour";
char *str3 = "salut";
char *str4 = "hey";
printf("%d\n", ft_strcmp(str1, str1));
printf("%d\n", ft_strcmp(str1, str2));
printf("%d\n", ft_strcmp(str1, str3));
printf("%d\n", ft_strcmp(str1, str4));
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: