How do I dynamically allocate a 2d array of chars?
<p>I want to dynamically allocate a 2d array to store strings.</p>

<p>I originally declared the array like this:</p>

<pre><code>char lines[numlines][maxlinelength];
</code></pre>

<p>This however gives me a stack overflow when numlines is very huge.</p>

<p>How can I dynamically allocate it to prevent stack overflow?</p>