array declaration

Richard Bumby bumby at math.rutgers.edu
Thu May 11 05:50:04 AEST 1989


In article <12724 at umn-cs.CS.UMN.EDU> clark at umn-cs.CS.UMN.EDU (Robert
P. Clark) writes:

> There is lots of talk about why
> 
>              int a[][] = {
>                           <data omitted>
>              };
> 
> 
> won't compile.  My compiler barfs at this too.  But if
> you change the declaration to
> 
>              static int a[][] = {
>                           <data omitted>
>              };
> 
> it compiles fine.  This is what I do to get around the
> problem, but I'm not exactly sure why this works and the
> first doesn't.  Can anyone shed some light on this?
> 
> ... <signature deleted>...

My guess is that your (unidentified) compiler is just providing an
extension of the type suggested by the original poster in a context
where it would be reasonably safe.  I used the first edition of K & R
as a reference, but have done no experiments with the various C
environments that I have access to (I guess I am still just a pure
mathematician).  I found that section 5.7 was sufficiently clear about
declaration and use of multidimensional arrays, and section 8.4 of the
reference manual (appendix A) about the limitation of "arrays of
unknown size" that I never pursued the matter further.
--
-- 

--R. T. Bumby ** Math ** Rutgers ** New Brunswick **
(in one form or another for all kinds of mail)
[bumby at math.rutgers.edu]



More information about the Comp.lang.c mailing list