|
Constant array size
I know in C, arrays have to of a constant size.
However when I do something like:
const int size = 10;
int list[size];
I get thrown an error that the array size must be a constant expression (at the line where the array is declared). However, when in C++ when I do this it compiles fine. I'm using Visual Studio 2005, by the way.
However, when I switch to "Compile as C++ code" it compiles the .c file correctly. So is this valid for any C code, or just the Visual Studio compiler?
Last edited by alman9898 : 04-23-2008 at 02:47 PM.
|