So, I'm currently stuck on pset3. I'm doing the linear search coding on helpers.c but it doesn't seem to search for the needle in the hay stack. It is behaving quite weird.
If i run ./generate 1000 50 | ./find 127 It returns "Didn't find needle in haystack."
And if i randomly give numbers myself by giving the command ./find 5 then if the number 5 is at the beginning it always returns "Didn't find needle in haystack." but if the number 5 is in the middle somewhere it works fine.
This is my linear search code inside the helpers.c file
And this is the find.c file from where it is called.