 <p>Standard C++ does not support the variable length arrays (VLAs) of C99 and g++.</p> <p>In standard C++ you can use e.g. <strong><code>std::vector</code></strong>, like this (your code modified):</p> <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; int main(){ int sz; std::cout&lt;&lt;"number?\n"; std::cin&gt;&gt;sz; // This line std::vector&lt;double&gt; dynamic_arr( sz ); // Initialized to zeroes. //output the value just to use the array. std::cout&lt;&lt;dynamic_arr[0]&lt;&lt;std::endl; } </code></pre> <p>Also, for strings you can use <strong><code>std::basic_string</code></strong>, usually via the <code>typedef</code>s <code>std::string</code> and <code>std::wstring</code>.</p> <p>Generally the main problem is just the dynamic size, as above, and then <code>std::vector</code> and <code>std::basic_string</code> do the job nicely. However, sometimes the problem is efficiency, how to do extremely efficient <em>stack allocation</em> of a dynamic size array. Many C and C++ implementations support the non-standard function <strong><code>alloca</code></strong> for that, but unfortunately they differ greatly in how it handles failures. As far as I know there is no commonly available library solution for that either. But happily, the main usage that I know of (even though as mentioned <code>alloca</code> is available for a number of platforms) has been for string encoding translation in Windows, and that's less and less relevant as time goes on and Windows programs more and more are pure Unicode-oriented.</p>