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