title: What does "control reaches end of non-void function" mean?
body: <p>I've been getting strange compiler errors on this binary search algorithm. I get a warning that <code>control reaches end of non-void function</code>. What does this mean?</p>
  
  <pre><code>int binary(int val, int sorted[], int low, int high) {
      int mid = (low+high)/2;
  
      if(high &lt; low)
          return -1;
  
      if(val &lt; sorted[mid])
          return binary(val, sorted, low, mid-1);
  
      else if(val &gt; sorted[mid])
          return binary(val, sorted, mid+1, high);
  
      else if(val == sorted[mid])
          return mid;
  }
  </code></pre>