:( finds 42 in {42,40,39,41} \ expected an exit code of 0, not 1 What can I make out of this error message. Here's my code for binary search,selection sort:

1 Answer 1


At the end of your while loop you have a 'return false'. Unless your first if is true, you exit the while loop giving false.

  • I did that but that doesn't stop the error messages as I have edited in the question above (plse check). Any suggestions plse!
    – sk.76
    Jun 17, 2017 at 6:15
  • Check your sort function. All the other arrays in CS50 check are already sorted. In the second for loop you just move the indexes in the array, not the values themselves.
    – Endgament
    Jun 17, 2017 at 7:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .