Array parameters

Paul Schauble Schauble at MIT-MULTICS.ARPA
Tue Jan 8 15:59:57 AEST 1985


Pardon my lack of familiarity with modern C. I do hope someone will take
time to answer this:

>From Joseph S.D. Yao <hadron!jsdy at SEISMO> commenting on the declaration

      int a[5][6];

as a function formal parameter.

> Oh, and i think you may have missed the earlier comment that, despite
> the syntactic sugar of declaring the argument as if it were an array,
> it actually i s a pointer, in compatibility with early versions of C
> that wouldn't let you pass anything longer than a word/longword as an
> argument.  The pointer's size is correctly returned by sizeof().

Current C compilers allow passing a structure as a parameter. That's a
real  structure, not a pointer to a struct as in the old style.

I presume then that one can pass a real array in the same fashion.

then if 

     function (a);
     int a[5][6]

says that the parameter is "really" a pointer, for compatability, what
does the declaration look like when the parameter is really an array?

Or where did I go wrong?

          Paul
.



More information about the Comp.lang.c mailing list