title: How to take array size of length as user input?
body: <p>I would like to improve my program with user-input of array length. Is that possible in C?</p>
  
  <p>This my code:</p>
  
  <pre><code>int main() {
      int sum = 0;
      int a;
      int array[a] = {};
      printf("Insert length of array:\n");
      scanf("%d", &amp;a);
      for (int i = 0; i &lt; a; i++) {
          printf("Insert number %d \n", i + 1);
          scanf("%d", &amp;array[i]);
      }
      for (int i = 0; i &lt; a; i++) {
          sum = sum + array[i];
      }
      printf("Sum is %d \n", sum);
      return 0;
  }
  </code></pre>
  
  <p>However when I try to compile it, it says: <code>error: variable-sized object may not be initialized</code></p>
  
  <p>Any possible solution?</p>