title: control reaches end of non-void functions -wreturn-type
body: <p>This is the code for finding the maximum of four numbers:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;
  #include &lt;cstdio&gt;
  using namespace std;
  
  int max_of_four(int a,int b,int c,int d) {
      if(a&gt;b&amp;&amp;a&gt;c&amp;&amp;a&gt;d)
      return a;
      else if(b&gt;a&amp;&amp;b&gt;c&amp;&amp;b&gt;d)
      return b;
      else if(c&gt;a&amp;&amp;c&gt;b&amp;&amp;c&gt;d)
      return c;
      else if(d&gt;a&amp;&amp;d&gt;c&amp;&amp;d&gt;b)
      return d;
  }
  
  int main() {
    int a,b,c,d;
    scanf("%d %d %d %d",&amp;a,&amp;b,&amp;c,&amp;d);
    int ans;
    ans=max_of_four(a,b,c,d);
    printf("%d",ans);
    return 0;
  }
  </code></pre>
  
  <p>But I am getting a warning like this:</p>
  
  <blockquote>
    <p>control reaches end of non-void function -wreturn-type</p>
  </blockquote>
  
  <p>What does this error mean?<br>
  Why does this error occur?</p>