Array parameters

Mark Terribile mat at hou4b.UUCP
Thu Jan 10 07:24:56 AEST 1985


> 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.

Nope.  Structures and arrays are fundamentally different sorts of aggregates
with very different properties.

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

In this case, what you have is equivalent to

	int	(*a)[ 6 ];

-- a pointer to an array of six ints.  One of our local compilers
accepts all of these without complaint:
f( a )
int a[5][6];
{
	y( a );
}
g( a )
int a[5][];
{
	y( a );
}
h( a )
int a[][6];
{
	y( a );
}
i( a )
int (*a)[6];
{
	y( a );
}
-- 

	from Mole End			Mark Terribile
		(scrape .. dig )	hou4b!mat
    ,..      .,,       ,,,   ..,***_*.



More information about the Comp.lang.c mailing list