Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. char *ft_strstr(const char *str, const char *sub)
  2. {
  3. int i;
  4. int pos;
  5. int len;
  6.  
  7. i = 0;
  8. pos = 0;
  9. len = 0;
  10. while (sub[len] != '\0')
  11. len++;
  12. if (len == 0)
  13. return ((char *)str);
  14. while (str[i])
  15. {
  16. pos = 0;
  17. while (sub[pos] == str[i + pos])
  18. {
  19. if (pos == len - 1)
  20. return ((char *)str + i);
  21. pos++;
  22. }
  23. i++;
  24. }
  25. return (NULL);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement