How do you use a void pointer to generate 2D dynamic Array?
<p>Does anyone know how to use a void pointer to generate a 2D array rather than an int pointer?</p>

<p>For integer pointer, I do as follow:</p>

<pre><code>int **m;

m = new int* [row];     
for(int i=0; i&lt; row; i++)     
        m[i] = new int[col];

for (int i = 0; i &lt; row; i++)
       for (int j = 0; j &lt; col; j++)
             m[i][j] = rand () % 10;
</code></pre>

<p>What if the pointer type is void***m?</p>

<p>How can I define the storage like int? eg.(m = new int* [row];)</p>

<p>Thanks for your help.</p>

<hr>

<p>Please allow me to specify my question clearer, I'm given these:</p>

<pre><code>class Matrix
{
   public:
           Matrix();
           Matrix(int,int);

           void printMatrix();

   private:
           int row;
           int col;
           void***m;
           void initMatrix();      // Initialize the storage for row and column
           void generateMatrix (); // construct a 2D array
}
</code></pre>
