Skip to main content
8 events
when toggle format what by license comment
Nov 18, 2016 at 13:18 vote accept A. H.
Nov 18, 2016 at 12:46 vote accept A. H.
Nov 18, 2016 at 12:52
Nov 17, 2016 at 22:07 comment added Martin Kleiven @A.H. Now that you have your errors sorted out, you're back to figuring out how to make it work. Debugging a binary search function is tedious though, so I recommend paying close attention to the spec and also look up some resources; I'd start with stackoverflow.com/questions/504335/… and then I also found an interesting article on the topic cprogramming.com/tutorial/binarysearchchallenge.html, skip over any code you see though, as implementing binary search yourself is half the fun! Also please accept one of our answers :)
Nov 17, 2016 at 21:55 comment added Martin Kleiven It is still applicable, it is part of the of the C standard. That said I now see you we're actually referring to binarysearch and not specifically to main, given that main was written by staff and is functional and that binarysearch is clearly missing a return.
Nov 17, 2016 at 21:43 comment added MARS This is not applicable in this case. We have a function that has to return a value and the error is clear
Nov 17, 2016 at 20:07 comment added Martin Kleiven @MARS Since c99 main is not required to return 0, it is the default behaviour when nothing else is returned. stackoverflow.com/a/4138710/6091017
Nov 17, 2016 at 19:48 comment added A. H. I added a return false; just above the last curly bracket but now when I run find it says the needle wasn't found no matter what, even if I enter a value I know for sure is in the generated numbers. Any idea why this might be?
Nov 17, 2016 at 16:37 history answered MARS CC BY-SA 3.0