This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Variable length array


Luigi Pilo <L.Pilo@damtp.cam.ac.uk> writes:

> Trying to compile the following with gcc version 2.7.2.1 or egcs-1.0.3

> int main() { int dim; dim = 3; int gnu_array[dim]; return 0; }

> test.c:7: parse error before `int' .

Unlike in C++, declarations are disallowed after statements in C.  You 
must start a new scope in order to be able to declare more variables.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]