 <p>You can allocate the array as a contiguous bloc like this. Suppose you want ints:</p> <pre><code>int (*arr)[secondCount] = malloc( sizeof(int[firstCount][secondCount]) ); </code></pre> <p>You could hide this behind a macro which takes the typename as a macro argument, although the code is simple enough that that is not really necessary.</p>