title: How does this C int function works without a return statement?
body: <p>I've this C code which I was sure it wouldn't work, but it does.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int* find (int* a, int val) {
      if (*a == val)
          return a;
      else
          find(a+1, val);
  }
  
  int main() {
      int a[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
      int *b;
  
      b = find(a, 7);
  
      printf("%d\n", *b);
  
      return 0;
  }
  </code></pre>
  
  <p>Of course, I get a warning from gcc since it lacks a return statement inside the else branch of the <code>find</code> function. However, it works perfectly.</p>
  
  <p>Why does this happen? How does it know to return an int through the recursive function? Of course, the last calls returns an int, but I'm calling it in a void context. </p>