I have created a data structure that contains a multidimensional array member. The dimensions of this array are ultimately supplied by user input and are known at the construction of the struct, but not before. I have provided a minimal working example that hopefully demonstrates the problem:
struct MyStruct{
int rows;
int cols;
float data[][];
MyStruct(int m, int n) : rows(m), cols(n){
data[m][n];
}
};
In VSC I get a parsing error on float data[][];
that reads: 'an array may not have elements of this type'
So, is there a way to initialize the dimensions of a multi-dimensional array at the time of construction? Or do I need to create a new struct/class to hold the data?