title: Variable-length array in file scope?
body: <p>I have this code for example.</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #define array_size 3
  
  typedef struct {
      int array[array_size];
  } TEST;
  
  void printout(TEST *p, int element) {
      printf("element: %i\n", p-&gt;array[element]);
  }
  
  int main(void) {
      TEST *p;
      p = malloc(sizeof(TEST));
      p-&gt;array[0] = 5;
      printout(p, 0);
  
      return 0;
  } 
  </code></pre>
  
  <p>But I'd like to assign <code>"array_size"</code> based on user input. </p>
  
  <p>If I try to do so, the compiler says <strong><code>"variably modified ‘array_size’ at file scope"</code></strong>. So, am I right that the only way to do what I want is to move everything to main()..? </p>
  
  <p>It works just fine, but keeping <code>structs and functions declarations</code> in file scope seems, you know, neat. </p>