I'm working on linear search. When I test manually, it works correctly, and "echo $?" will show a 0 and 1 as expected. I have tried it with piped-in data sets, with the 127 and 128 examples from the instructions, and with the "find 42" things in the check50 results. I verify with "echo $?". All return as expected.
When I run it through check50, it fails as below. It's not a timeout issue or an intermittent issue, same exact results across 3 days and many attempts.
I have used the same function declaration as originally provided in helpers.h.
Command: check50 2015.fall.pset3.find 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}
\ expected an exit code of 1, not 0
:( doesn't find 42 in {39,40,41,43}
\ expected an exit code of 1, not 0
https://sandbox.cs50.net/checks/27f2ac1ae0094ccebecbfaefcd5fbe73
My code:
bool search(int value, int values[], int n)
[removed for honor code purposes]
return 0;
}
}
return 1;
}