Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "libft.h"
- char *ntm_strstr(const char *s1, const char *s2)
- {
- int i;
- i = 0;
- while (*s1)
- {
- if (*s1 == s2[i])
- i++;
- else if (*s1 != s2[i])
- {
- s1 = (s1 - i);
- i = 0;
- }
- if (s2[i] == '\0')
- return ((char *)s1);
- s1++;
- }
- return (NULL);
- }
- int main()
- {
- if (NULL != ft_strstr("aaabbbaaabbb", "aabbba"))
- write(1,"ok\n",3);
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement