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