I'm trying to allocate an array as follows:
class foo{
public:
void func(){double arr[13][64][64][64];}
};
int main()
{
foo* inst = new foo();
inst->func();
return 0;
}
I was under the impression from answer such as: Does this type of memory get allocated on the heap or the stack? that the array arr would be placed on the heap (as the instance of the class is on the heap). This doesn't seem to be the case as I get a segmentation fault. If I change a's declaration to: double* arr = new double[13*64*64*64]; (and delete it properly) then everything's fine.
What's happening here?