title: Implicit declaration of function x
body: <p>I'm well aware of function prototypes, this error seems to be a function declaration error, which means I'm really bewildered as to why I'm see this warning and thus error.</p>
  
  <p>It's almost like gcc completely ignores my function prototype. Is this a compiler bug? </p>
  
  <p>In the interest of brevity, I did not declare this function in a separate header file, though it should make no difference.</p>
  
  <p>gcc output:</p>
  
  <pre><code>$ gcc -Wall -std=c99 -pedantic primefactors.c
  primefactors.c: In function ‘main’:
  primefactors.c:8:5: warning: implicit declaration of function ‘largestprime’ [-Wimplicit-function-declaration]
  primefactors.c: At top level:
  primefactors.c:12:6: error: conflicting types for ‘largestprime’
  primefactors.c:8:20: note: previous implicit declaration of ‘largestprime’ was here
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  long largetsprime(long);
  
  int main()
  {
      printf("%d\n", largestprime(600851475143));
      return 0;
  }
  
  long largestprime(long num)
  {
      int highest;
      int mid = sqrt(num);
      for (int i = 2; i &lt; mid; i++) {
          if (mid % i == 0) {
              if (i % 1 == 0 &amp;&amp; i % i == 0)
                  highest = i;
          }
      }
      return highest;
  }
  </code></pre>