"variable-size type declared" error for const sized array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I want to use a const int to specify the size of an array but get the
error: "variable-size type declared outside of any function".

If I use a literal (e.g. 5) for the array size then compilation is fine. 

Is there a gcc flag that would allow me to use const variables to
define array sizes? I see no difference between the two apart from the
fact that a variable eliminates the cryptic magic number. (Yes a
#define would solve it, but I don't want to use it.)

Thanks,
Bahadir


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux