title: C, how to call a function
body: <pre><code>#include &lt;stdio.h&gt;
  
  void average(float age[]);
  
  int main(void)
  {
      float *p;
      float avg = 0.0;
      float age[] = { 23.4, 55, 22.6, 3, 40.5, 18 };
      p = &amp;age[0];
      avg = average(age);
      printf("\n\nAverage age = %.2f\n\n\n", avg);
      return 0; // this should return the average age from the void average() function
  }
  
  void average(float age[])
  {
      float *p;
      p = &amp;age[0];
      int i = 0;
      float avg = 0.0 , sum = 0.0;
      for (i = 0; i &lt; 6; ++i) 
      {
          sum += *(p+i);
      }
      avg = (sum / 6);
      //return avg; // this should be a return 0 (to go with the void)
  }
  </code></pre>
  
  <p>Hi I am very very new to C, I am supposed to make the function "average" a void which i have done and then output everything in the main. Im not sure how to go about this, everything I try i get errors. I'd like to do it without creating another function if possible. </p>