When building a multi-index array in C, it is possible to leave "open" the first index, either via a pointer
#define A 3
#define B 5
#define C 2
double aux[A][B][C] = {[0 ... A-1][0 ... B-1][0 ... C-1]=1.0};
double (*s)[B][C] = aux;
or simply with the array notation (but in this case I do not know how to use the auxiliary variable)
double s[][B][C] = {[0 ... A-1][0 ... B-1][0 ... C-1]=1.0};
Now, if we want to leave open an intermediate index, s[A][][C], I think the only solution is to declare an array of pointers, isn't it? For A=3, the following two initializations work
double (*t[A])[C] = {aux[0],aux[1],aux[2]};
double (**u)[C] = t;
and we can use t[i][j][k] or u[i][j][k] in the main code.
But consider A = 100. Is there some way to declare all the aux[0...A-1] pointers in a compact way in the initializer? , or somehow "cast" aux into t or into u?
Note: as Jonathan points out, triple-dot is a gcc extension. For this question, well, I am happy to initialize to zero anyway, or having a random aux. An answer just reserving memory, such as
double aux[A][B][C];
double (*t[A])[C] = (miraculous cast) aux[];
double (**u)[C] = t;
would be enough, if triple-dots and initializers can not help.
possible hint?: If I do
double *trivial[A] = {aux[0],aux[1],aux[2]};
double (**v)[C] = trivial;
I get an interesting (multiple) warning, repeated for each assignment in the initializer
warning: incompatible pointer types initializing 'double *' with an expression of type 'double [5][2]' [-Wincompatible-pointer-types]
double *trivial[A] = {aux[0],aux[1],aux[2]};