Advertisement
Guest User

Untitled

a guest
Nov 27th, 2015
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include "libft.h"
  2.  
  3. char *ntm_strstr(const char *s1, const char *s2)
  4. {
  5. int i;
  6.  
  7. i = 0;
  8. while (*s1)
  9. {
  10. if (*s1 == s2[i])
  11. i++;
  12. else if (*s1 != s2[i])
  13. {
  14. s1 = (s1 - i);
  15. i = 0;
  16. }
  17. if (s2[i] == '\0')
  18. return ((char *)s1);
  19. s1++;
  20. }
  21. return (NULL);
  22. }
  23.  
  24. int main()
  25. {
  26. if (NULL != ft_strstr("aaabbbaaabbb", "aabbba"))
  27. write(1,"ok\n",3);
  28. return (0);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement