Advertisement
Vitamin4eg

Untitled

Oct 22nd, 2018
98
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(char *str, char *to_find)
  2. {
  3. unsigned int pos;
  4. unsigned int i;
  5.  
  6. if (!to_find)
  7. return (str);
  8. pos = 0;
  9. while (str[pos] != '\0')
  10. {
  11. if (str[pos] == to_find[0])
  12. {
  13. i = 1;
  14. while (to_find[i] != '\0' && str[pos + i] == to_find[i])
  15. ++i;
  16. if (to_find[i] == '\0')
  17. return (&str[pos]);
  18. }
  19. ++pos;
  20. }
  21. return (0);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement