title: Memory allocation of variables on stack, c++
body: <p>I am new to c++ programming and wasn't quite able to understand the following code difference:</p>
  
  <pre><code>int n;
  cin &gt;&gt; n;
  int list[n];
  </code></pre>
  
  <p>and</p>
  
  <pre><code>int n;
  cin &gt;&gt; n;
  int *list = new int[n];
  </code></pre>
  
  <p>and how c++ compiler deals with this kind of code ?</p>
  
  <p>Edit: Please its not about pointers. I want to know how memory is allocated for "list" variable in the first block of the code as "n" value is determined at runtime.</p>
  
  <p>possible duplicate: <a href="https://stackoverflow.com/questions/1887097/variable-length-arrays-in-c">Why aren&#39;t variable-length arrays part of the C++ standard?</a></p>