title: Allocating memory for array of pointers of int dynamically
body: <p>If I want to dynamically allocate memory for array of pointers of int, how can I achieve this requirement?</p>
  
  <p>Suppose I declare an array of pointers of int like this: </p>
  
  <pre><code>int (* mat)[];
  </code></pre>
  
  <p>Is there a way I can allocate memory for K number of pointers dynamically and assign it to mat? If I do </p>
  
  <pre><code>mat = new int * [K];
  </code></pre>
  
  <p>It gives error : <code>cannot convert 'int**' to 'int (*)[]' in assignment</code>. I understand this memory allocation is implicitly got converted to int **. Is there any way to allocate memory for above scenario?</p>
  
  <p>Even when I try to assignment of statically allocated array of pointers of int to array of pointers of int, like this: </p>
  
  <pre><code>int (*mat)[] = NULL;
  int (* array_pointers)[26];
  mat = array_pointers;
  </code></pre>
  
  <p>Compilation gives this error: <code>cannot convert 'int (*)[26]' to 'int (*)[]' in assignment</code>.</p>
  
  <p>Can someone please explain to me why this is an error or why it should be an error?</p>