array declaration

Robert P. Clark clark at umn-cs.CS.UMN.EDU
Wed May 10 23:44:53 AEST 1989




There is lots of talk about why

             int a[][] = {
                          { 1, 2, 3 },
                          { 4, 5, 6 },
                          { 7, 8, 9 }, 
             };


won't compile.  My compiler barfs at this too.  But if
you change the declaration to

             static int a[][] = {
                          { 1, 2, 3 },
                          { 4, 5, 6 },
                          { 7, 8, 9 },
             };

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?



                     Bob Clark        clark at umn-cs.cs.umn.edu

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~                                                       ~
    ~          Never underestimate the bandwidth of         ~
    ~          a station wagon  - Andrew Tannenbaum         ~
    ~                                                       ~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the Comp.lang.c mailing list