title: Why can't I initialize a variable-sized array?
body: <p>GCC gives no error when you initialize a variable-sized array as long as the variable is const, but when it isn't, it won't compile.</p>
  
  <p>What's the reason behind this? What's so wrong with doing:</p>
  
  <pre><code>int size = 7;
  int test[size] = {3, 4, 5};
  </code></pre>
  
  <p>That won't compile at all, but if I don't initialize test[] then it does compile! That doesn't make any sense to me, because as far as I know a stack frame needs to be made to fit this array according to its size(7 ints) no matter what(which means the integer literals I use don't really have any meaning, if I'm not mistaken), so what difference does it make if I initialize it or not?</p>
  
  <p>Just another one of my crazy C++ design questions...</p>
  
  <p>Thanks!</p>