Date: Wed, 29 Nov 1995 22:00:59 +0300 From: "Alexander V. Lukyanov" To: djgpp AT sun DOT soe DOT clarkson DOT edu, mewesolo AT freenet DOT calgary DOT ab DOT ca Subject: Re: Declaring arrays inside generic function > From: "Michael E. Wesolowski" > Date: Mon, 27 Nov 1995 20:37:32 -0700 > ... > I have a generic function which has as one of its input parameters an int > which identifies an array size. Within the function, I attempt to declare > an array of int's: > > int item_count [array_size]; > > where array_size is the input parameter. When I look at the array in the > debugger (gdb) however, what i see is an array of int pointers (I think) > - something like int (*) [60000] (the 60000 is approximate). If I > explicitly declare the array as, for example, item_count [10], I get the > expected array of 10, uninitialized ints. SO, what's the problem? > Surely, dynamic size arrays is very useful extension of C. It implemented (I think) via ``alloca'' builtin. So, declaring such an array equivalent to declaring a pointer and initializing it to alloca(array_size*sizeof(int)). And finally, int (*) [60000] meens 'pointer to array sized 60000' and not 'array of pointers'. BTW, there is no problems with that.