My question is very basic, but I couldn't find anything about it. I have an array of pointers. I want to assign it like this
mat* quickAccessMatrices[6] = {&MAT_A,&MAT_B,&MAT_C,&MAT_D,&MAT_E,&MAT_F};
with MAT_A,MAT_B,...,MAT_F being variables of type mat, which is a structure defined elsewhere. this gives a warning when using -pedantic flag, saying
initializer element is not computable at load time
so I think it means I shouldn't do it.
Is there a way to do something like this:
mat* quickAccessMatrices;
quickAccessMatrices = {&MAT_A,&MAT_B,&MAT_C,&MAT_D,&MAT_E,&MAT_F};
just without it giving an error?
Or do I just need to assign it values slot by slot?
By the way, since people were asking, here is how I define mat
typedef struct mat {
double matrix[4][4];
} mat;
I am well aware this isn't that good, but it is necessary in my case To be clear, I know that I can use normal assignment after the definition, but I'm asking if there is a better way.