MyClass.hxx
class MyClass{
private:
int ** myArray;
};
MyClass.cxx
void MyClass::setArray()
{
int arraySize = 10;
myArray = new int*[arraySize]
for (int i = 0; i < 2; ++i) {
myArray[i] = new int[arraySize]
}
}
My question is, does this code create a 2D array constrained in one direction to two items, and constrained in the other by arraySize, similar to:
int const exampleArray[][2]{
{ 1 , 1 }
{ 1 , 1 }
{ ... , ... }
}
I currently am able to write to the array after created (the first way) but have "undefined" behaviour about how far into the array I can write.
So my question is, what is the MyClass code doing, and how do I get the desired effect?