I'm maintaining a part of code written by my friend, here's a definition of a variable called d
:
double (*d)[3];
I tried to initialize the variable using the code below but in each part there is an error (runtime or compilation). I have gotten confused whether variable d
is a pointer to array of double or array of pointers to double.
double k;
(*d)[0] = k; // runtime error using gcc compiler
d[0] = &k; // Compilation error, assignment to expression with array type
*d = &k; // Compilation error, assignment to expression with array type