View Single Post
Old Nov 16th, 2006, 4:05 AM   #3
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3 Jimbo is on a distinguished road
First off, you're making a pointer to a pointer to an array of integers. From a simplistic view (though not entirely accurate, grumpy or Narue can and have explained much better if you want the nitty-gritty) this could be simplified as either int*** or int[][][]. I'm guessing that's not what you want.

For the sake of I-should-be-in-bed-right-now, I'll just give a quick sample which should work... but if it doesn't, well, sorry
int **matri1 = new int*[r];
for(int i = 0; i < r; i++)
  matri1[i] = new int[c];
Note that I dropped the [] from the declaration of matri1. Then I initialized it as an array of int*. Then I made each of the int* into an array of size c.
__________________
<insert disclaimer here>
<insert shameless plug for Visual Studio here>
Jimbo is offline   Reply With Quote