title: Various questions about arrays in C
body: <p>So I am trying to learn C right now, and I am writing basic scripts to ensure I have the foundations, but I am struggeling to understand the problem with the following code:</p>
  
  <pre><code>#include &lt;stdio.h&gt; //Linking external libraries.
  #include &lt;math.h&gt;
  
  int main(void) {
      /* First I will set my variables.
      */
      double std; //Standard Deviation
      double sqdif;
      double avg;
      int N=10; //number of elements
      double X[10]; //Not sure why I cannot use N here.
      int i;
  
  
      /* Now I will prompt for input and listen for values,
      then assign those values respectively.*/
  
      for (i = 1; i &lt; 11; i++) {
          printf("Please enter X[ %d ", i);
          printf("]: ");
          scanf("%d", &amp;X[i-1]);
      }
  
      for (i = 0; i &lt; N; i++) {
          avg = avg + X[i];
          printf("\n %d", X[i]);
      }
      avg = avg / N;
      printf("\nThe average is: %d", avg);
  
  
      return 0;
  }
  </code></pre>
  
  <p>My two main questions are as such:</p>
  
  <ol>
  <li>Why can I not use N to define my array X?</li>
  <li>Why is my script returning:</li>
  </ol>
  
  <blockquote>
    <p>1
         4196197
         4196197
         4196197
         4196197
         4196197
         4196197
         4196197
         4196197
         4196197
        The average is: 4196197</p>
  </blockquote>
  
  <p>for my results? If you see the error in the code please let me know!</p>
  
  <p>Thanks,</p>
  
  <p>Ps. this is obviously an incomplete script.</p>