Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char *ft_strstr(char *str, char *to_find)
- {
- unsigned int pos;
- unsigned int i;
- if (!to_find)
- return (str);
- pos = 0;
- while (str[pos] != '\0')
- {
- if (str[pos] == to_find[0])
- {
- i = 1;
- while (to_find[i] != '\0' && str[pos + i] == to_find[i])
- ++i;
- if (to_find[i] == '\0')
- return (&str[pos]);
- }
- ++pos;
- }
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement