title: undeclared (first use in this function) in C
body: <p>I know when you type this into search, there are a few similar "like" questions. Yet, all the ones I saw that weren't duplicate were from other sources besides C. Anyway, hope someone can help.
  I have a structure, declared in my header obviously.</p>
  
  <pre><code>struct Statistics //Super basic structure.
  {
   int mean;
   int median;
   int variance;
   int grades;
   int min;
   int max;
  }; 
  </code></pre>
  
  <p>All of these functions are working properly without the structure, that's why I'm trying to use one. For cleanliness, and just pure understanding.
  My error is this, I get the line <strong>'stats' undeclared (first use in this function)</strong> when I call the function this structure is within.</p>
  
  <p>This is where the error send me to: </p>
  
  <pre><code>display_grades_distribution(m, grades_scale,n, stats);
  </code></pre>
  
  <p>So my question is this, how could my compiler tell me that this structure is 'undeclared' and or that its the 'first use' in the program.</p>
  
  <p>SNIPPET:</p>
  
  <pre><code>void display_grades_distribution(int m, int grades_scale[11][m], int n,         
  struct Statistics stats[])
  {
   printf("Mean = %22f\n", stats[0].mean);
   printf("Variance = %18f\n", stats[0].variance);
   printf("Median = %20f\n", stats[0].median);
   printf("min = %16d\n", stats[0].min);
   printf("max = %16d\n", stats[0].max);
  }
  
  int main(void)
  {
   //-------------------------------------------
    for(m = 0, m &lt; num_assignments; m++)
    {
    struct Statistics stats[5];
    stats[m].mean = calculate_mean(grades,n);
    stats[m].median = calculate_median(grades,n);
    stats[m].variance = calculate_mean(grades,n);
    stats[m].min = calculate_min(grades,n);
    stats[m].max = calculate_max(grades,n);
    }
   //-------------------------------------------
   **display_grades_distribution(m, grades_scale,n, stats);** //This causes the error.
  }
  </code></pre>