pointers to arrays and the '&' operator

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Feb 17 03:19:13 AEST 1989


In article <3927 at ingr.com> crossgl at ingr.com (Gordon Cross) writes:
>Allright, the recent discussion regarding pointers to arrays in C reminds
>me of something that I consider to be a major deficiency of the language.

It is actually the fact that arrays are not first-class objects in C
that is the deficiency.  This cannot be fully remedied without
invalidating large amounts of existing correct code.

>Since I am allowed to declare something that has type "pointer to an array
>of...", then why am I not permitted to apply the '&' (address of) operator
>directly to an array??

In ANSI C, you are allowed to do so.

Many existing (PCC-based) compilers permit &array but ignore the &.
That is not the ANSI C behavior, though.  For maximal portability
you should avoid using &array for a few years.



More information about the Comp.lang.c mailing list