title: C: filling an array with random numbers in a range
body: <p>I am trying accomplish the following tasks using C and arrays:</p>
  
  <p>This is what I could do for now. I also need to print the output. What should I do or edit, thanks.</p>
  
  <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt;
  #include &lt;time.h&gt;
  #include &lt;stdlib.h&gt;
  int main()
  {
      int n;
      printf("How many elements in array?:");
      scanf("%d",&amp;n);
      int array0[n];
      for(int i = 0 ; i &lt; n ; i++)
      {
        array0[i]= rand()%9 + 1;
      }
  
      int array1[10];
  
      for(int i = 0 ; i &lt; 10 ; i++)
      {
        array1[i]= 0;
      }
      int index;
      for(int i = 0 ; i &lt; n ; i++)
      {
        index = array0[i];
        array1[index-1]++;
      }
  }
  </code></pre>