i am trying to create a labelled 2d array of GRects called brick[i][j]. implementing the code below i am getting an error:
breakout.c:112:23: error: variable-sized object may not be initialized ...brick[i][j] = newGRect(i*(40/400) + (2/400), j*(60/600) + (6/600), 36*WIDTH/400, 36*HEIGHT/600); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
i used the variables WIDTH and HEIGHT when initialising the paddle so i don't know why it has a problem with this method. i guess it might have something to do with calling i and j in the way i have? but i can't see how...
void initBricks(GWindow window)
{
for (int j; j < COLS; j++)
{
for (int i; i < ROWS; i++)
{
GRect brick[i][j] = newGRect(i*(40/400) + (2/400), j*(60/600) + (6/600), 36*WIDTH/400, 36*HEIGHT/600);
}
}
}