Declaring array. Is this ok ?

Suntioinen Ari aps at tut.fi
Mon Nov 12 17:45:27 AEST 1990



I was wondering if following is legal in (ANSI) C:

int somefunc(int i)
{
	int  array[i]; /* Can I use i here ? */
 ...
}


or


int i;

int somefunc(void)
{
	int  array[i]; /* How about here ? */
 ...
}

I tried to figure it out from K&R. It went clearly
over my understanding. 

Gcc seems to accept both.

Thanks for advance,

--
 +------------------------------+--------------------------------------------+
 ! Ari Suntioinen -- aps at tut.fi ! There is no dark side in the Force really. !
 !                              !     As a matter of fact it's all dark.     !
 +------------------------------+--------------------------------------------+



More information about the Comp.lang.c mailing list