I need to efficiently allocate an array of two dimensions, one being known (5) and the other being unknown.
My aim is to have a continuous block of memory named block that stores my data in the following way : block[0,0] block[0,1] block[0,2] block[0,3] block[0,4] block[1,0] ...]
The following code compiles (in C++) :
unsigned int size2=200;
auto block = new float[size2][5];
Is it correct ? What is the type of the variable block ? I have tried :
float[5]* block = new float[size2][5];
float[5] block[] = new float[size2][5];
float block[][5] = new float[size2][5];
float block*[5] = new float[size2][5];
All of them leads to an error. I am running out of imagination...