Two dimensional dynamically allocated array problem
Hi everyone.
I'm having some trouble with dynamically allocating a 2D array. Here's the portion of code dealing with it.
Code:
myArrayOne = new int*[size];
for(int i = 0; i < size; ++i)
{
myArrayOne[i] = new int[3];
}
for(int i=0;i<size;i++)
{
for(int j=0;j<3;j++)
{
myArrayOne[i][j] = 0; // where program crashes
}
}
The program crashes and (I'm using VS2005) the error tells me that that expression cannot be evaluated. Now obviously I've made a mistake somewhere there but I can't spot it and this way seems to be working for other people judging from a google.
Any help appreciated.