title: C++ declare an array based on a non-constant variable?
body: <pre><code>void method(string a) {
    int n = a.size();
    int array[n];
  }
  </code></pre>
  
  <p>The above code can compile correctly using gcc. How can the size of the array come from a non-constant variable? Does the compiler automatically translate the <code>int array[n]</code> to <code>int* array = new int[n]</code>?</p>