While debugging locally, the program executes as expected, tested with random inputs and the check50 proposed inputs. When uploading by using check50, it returns the following, never finding 42 :
~/workspace/pset3/find/ $ check50 2016.find.more helpers.c
:) helpers.c exists
:) helpers.c compiles
:( finds 42 in {42,43,44}
\ expected an exit code of 0, not 1
:( finds 42 in {41,42,43}
\ expected an exit code of 0, not 1
:( finds 42 in {40,41,42}
\ expected an exit code of 0, not 1
:( finds 42 in {41,42,43,44}
\ expected an exit code of 0, not 1
:( finds 42 in {40,41,42,43}
\ expected an exit code of 0, not 1
:( finds 42 in {39,40,41,42}
\ expected an exit code of 0, not 1
:) doesn't find 42 in {39,40,41}
:) doesn't find 42 in {39,40,41,43}
:( finds 42 in {42,40,39,41}
\ expected an exit code of 0, not 1
https://sandbox.cs50.net/checks/a6706d4746af4c36a88bee91283974a8
locally using {43,44,42} as inputs in this order:
~/workspace/pset3/find/ $ debug50 ./find 42 < numbers.txt
haystack[0] =
haystack[1] =
haystack[2] =
haystack[3] =
Found needle in haystack!
debug shows everything as expected behaviour.
Code is as follow: helpers.c
// CODE
#define LIMIT 65536
//CODE
Why does LIMIT cause this error when set to 65536 and not when set to 65535? Even though it is written in the instructions, i would like to understand it.