Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Declaring array. Is this ok ? Message-ID: <1990Nov13.193813.9459@zoo.toronto.edu> Organization: U of Toronto Zoology References: Date: Tue, 13 Nov 90 19:38:13 GMT In article aps@tut.fi (Suntioinen Ari) writes: >I was wondering if following is legal in (ANSI) C: >int somefunc(int i) >{ > int array[i]; /* Can I use i here ? */ > ... >int i; >... >{ > int array[i]; /* How about here ? */ No. Array dimensions must be constant expressions, known at compile time. >Gcc seems to accept both. Gcc compiles an interesting language which is not ANSI C. -- "I don't *want* to be normal!" | Henry Spencer at U of Toronto Zoology "Not to worry." | henry@zoo.toronto.edu utzoo!henry