Closed Traezar closed 6 years ago
Same issue here, why would this be wrong ?
EDIT: Indeed, it's my fault. I found the issue.
For who's having the same issue, when there is a matching character, you should check for the next ones until i < len
too.
I was watching for i < len
in my first loop, not the matching loop.
ft_strnstr: [OK] [OK] [FAILED] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [fail]: your strnstr does not work with basic input Test code: char s1 = "MZIRIBMZIRIBMZE123"; char s2 = "MZIRIBMZE"; size_t max = strlen(s2); char i1 = strnstr(s1, s2, max); char i2 = ft_strnstr(s1, s2, max);
Diffs: strnstr: |(null)| ft_strnstr: |MZIRIBMZE123|