int ft_strcmp(char *s1, char *s2)
{
int i;
i = 0;
while (s1[i] && s2[i] && (s1[i] == s2[i]))
i++;
return (s1[i] - s2[i]);
}
/*
//ne macrche pas je ne comprend pas!
int ft_strcmp(char *s1, char *s2)
{
while (*s1 && *s2 && (*s1 == *s2))
++s1;
return (*s1 - *s2);
}
#include <stdio.h>
#include <string.h>
int main(void)
{
char *firt;
char *second;
firt = "World!";
second = "World!";
printf("%d\n", strcmp(firt, second));
firt = "World!";
second = "Wor!";
printf("%d\n", strcmp(firt, second));
firt = "Wor";
second = "World!";
printf("%d\n", strcmp(firt, second));
return (0);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: