Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int my_strcmp(char *s1, char *s2)
- {
- int i;
- int len1;
- int len2;
- i = 0;
- len1 = my_strlen(s1);
- len2 = my_strlen(s2);
- if (len1 == 0 && len2 == 0)
- return (0);
- if (len2 == 0)
- return (1);
- if (s1 && s2)
- while (s1[i])
- {
- if (s1[i] > s2[i])
- return (1);
- else if (s1[i] < s2[i])
- return (-1);
- i++;
- }
- if (i < len2)
- return (-1);
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement