0

I'm trying to initialize an array using already defined variables, for extensibility reasons.

Here are the calls that I'm making:

int dung_width = 160;
int dung_height = 105;

char dungeon[dung_height][dung_width];

I'm getting the error that dungeon is variably modified at file scope. Is this even possible and is this the best way of doing it?

P.S. I'm just starting C programming.

1 Answers1

1

Use like this they will not trouble you if they are constants:

#define dung_width  160
#define dung_height  105

char dungeon[dung_height][dung_width];