Advertisement
Alessyo

match

Jul 22nd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. int match(char *s1, char *s2)
  2. {
  3. if (*s1 == '\0' && *s2 == '\0')
  4. return (1);
  5. else if (*s1 == *s2 && *s1 != '*')
  6. return (match(s1 + 1, s2 + 1));
  7. else if (*s1 == '*' && *s2 == '*')
  8. return (match(s1 + 1, s2));
  9. else if (*s2 == '*' && *s1 == '\0')
  10. return (match(s1, s2 + 1));
  11. else if (*s2 == '*' && *s2 != '\0' && *s1 != '\0')
  12. return (match(s1, s2 + 1) || match(s1 + 1, s2));
  13. else
  14. return (0);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement