nikolas_serafini

Lista 8 - Exercício 10

Aug 11th, 2013
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.24 KB | None | 0 0
  1. int stringCompare(char *s1, char *s2) {
  2.  
  3.     while (*s1 != '\0' || *s2 != '\0') {
  4.         if (*s1 > *s2)
  5.             return 1;
  6.         else if (*s1 < *s2)
  7.             return -1;
  8.         else
  9.            s1++; s2++;
  10.     }
  11.     return 0;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment