title: Function calculate the mean
body: <p>I'm trying to calculate the mean of numbers using a function with an int number of the total double numbers in my array, but i just feel my function is awful, any advice on how i can improve my function?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  double meanOfPositive(double *arr, int length);
  
  int main()
  {
      int numValue = 6;
      double numbers[] = { 1.1, 2.2, 3.3, 4.4, 5.5, 6.6 };
      double mean2;
  
      mean2 = meanOfPositive(numValue, numbers);
  
      printf("Mean of all numbers is %.2f", mean2);
      getchar();
      return 0;
  }
  
  double meanOfPositive(double *arr, int length)
  {
      int numValue = 6;
      double tot = 0;
      double mean = 0;
      double numbers[] = { 1.1, 2.2, 3.3, 4.4, 5.5, 6.6};
  
      for (int i = 0; i &lt; numValue; i++)
      {
          tot = tot + numbers[i];
      }
      mean = tot / numValue;
      return mean;
  }
  </code></pre>