Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int ft_strcmp(char *s1, char *s2)
- {
- int run = 0;
- int res;
- while ((s1[run] != '\0') && (s2[run] != '\0'))
- {
- if (s1[run] == s2[run])
- run++;
- else if (s1[run] != s2[run])
- {
- res = s1[run] - s2[run];
- return res;
- }
- }
- return 0;
- }
- int main()
- {
- char *s1;
- char *s2;
- s1 = "huu";
- s2 = "hui";
- printf("%d", ft_strcmp(s1, s2));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment