title: Error: control may reach end of non-void function in C
body: <p>I cannot figure out why this error is happening: <code>error: control may reach end of non-void function</code></p>
  
  <p>Here is the code:</p>
  
  <pre><code>bool search(int value, int values[], int n) {
  
      if (n &lt; 1) {
          return false;
      }   
  
      for (int i = 0; i &lt; n; i++) {
          if (values[i] == value) {
              return true;
              break;
          }
          else { 
              return false;
          }
      }    
  }
  </code></pre>
  
  <p>I understand that the error means that the function may reach the end without returning anything, but I cannot figure out how that might happen.</p>