What does “control reaches end of non-void function” mean?

后端 未结 7 1668
野的像风
野的像风 2020-11-28 11:24

I\'ve been getting strange compiler errors on this binary search algorithm. I get a warning that control reaches end of non-void function. What does this mean?<

7条回答
  •  青春惊慌失措
    2020-11-28 11:40

    It means it's searching for a function that needs to be completed.

    else if(val == sorted[mid]) return mid;

    so, remove the if() part and modify the code or add an else() at the end which returns an int.

提交回复
热议问题