I am trying to initialize a 2D array named tiles
consisting of int
like this:
for (int i=0; i<d; i++)
{
for (int j=0; j<d; j++)
{
int tiles[d][d];
tiles[i][j] = (d**2 - 1)-(j+i);
}
But I get this error:
fifteen.c:192:34: error: indirection requires pointer operand ('int'
invalid)
int tiles[i][j] = (d**2 - 1)-(j+i);
(the error highlights the last *2
).
I do not know what exactly the problem with d**2 is, which I meant to be d^2. I have checked this answer, which means I know that math declarations can be used to initialize arrays, so I do not know what the matter might be.
Thank you all