title: Implicit declaration of function 'sum' is invalid in C99
body: <p>I've been looking for a solution to this but haven't found anything that will help.
  I'm getting the following errors:</p>
  
  <pre><code>Implicit declaration of function 'sum' is invalid in C99
  </code></pre>
  
  <pre><code>Implicit declaration of function 'average' is invalid in C99
  </code></pre>
  
  <pre><code>Conflicting types for 'average'
  </code></pre>
  
  <p>Has anyone experienced this before?  I'm trying to compile it in Xcode.</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  
      int main(int argc, const char * argv[])
      {
  
         @autoreleasepool
         {
            int wholeNumbers[5] = {2,3,5,7,9};
            int theSum = sum (wholeNumbers, 5);
            printf ("The sum is: %i ", theSum);
            float fractionalNumbers[3] = {16.9, 7.86, 3.4};
            float theAverage = average (fractionalNumbers, 3);
            printf ("and the average is: %f \n", theAverage);
  
         }
          return 0;
      }
  
      int sum (int values[], int count)
      {
         int i;
         int total = 0;
         for ( i = 0; i &lt; count; i++ ) {
            // add each value in the array to the total.
            total = total + values[i];
         }
         return total;
      }
  
      float average (float values[], int count )
      {
         int i;
         float total = 0.0;
         for ( i = 0; i &lt; count; i++ ) {
            // add each value in the array to the total.
            total = total + values[i];
         }
         // calculate the average.
         float average = (total / count);
         return average;
      }
  </code></pre>