Is it possible under VS 2008 C/C++ compiler, compiling the following code in/as a .c file ?
No. This is a C99 feature and MSVC doesn't support C99. You must have to declare i
before for
loop.
Domanda
Is it possible under VS 2008 C/C++ compiler, compiling the following code in/as a .c file ?
int f(int bounds)
{
int sum = 0;
for( int i = 0; i < bounds ; i++ )
{ .... }
return sum;
}
GCC seem to be ok with that C syntax, but it looks like VS'2008 is more expecting something like:
int f(int bounds)
{
int sum = 0, i;
for( i = 0; i < bounds ; i++ )
{ .... }
return sum;
}
Soluzione
Is it possible under VS 2008 C/C++ compiler, compiling the following code in/as a .c file ?
No. This is a C99 feature and MSVC doesn't support C99. You must have to declare i
before for
loop.