title: Create an array of consecutive numbers from 1 to n in C?
body: <p>I'm trying to code a function that will make an array of consecutive numbers from <code>1</code> up to a number <code>n</code>. For example, I would expect <code>array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}</code>. My code doesn't seem to be running but I don't exactly know why. </p>
  
  <pre><code>int count (int a)
  {
     scanf("%d", &amp;a);
     int i;
     int array[a];
     do
     {
        i = 0;
        a = a - i;
        array[a - 1] = a;
        i++;
     }
     while (a &gt; 0);
     printf("Resulting array is %d", array[a]);
     return 0;
  }
  </code></pre>