"array" vs. "&array" ?

Chris Torek chris at mimsy.umd.edu
Thu Jan 4 10:01:11 AEST 1990


In article <2368 at ektools.UUCP> randolph at ektools.UUCP (Gary L. Randolph) writes:
>3.) ANSI extended the language definition to allow taking the 
>    address of an array name, so an ANSI conformant compiler will
>    now (correctly) yield pointer to array of T, or pointer to
>    pointer to T.

There is no `or' about it!  The result is a pointer to an array, NOT
a pointer-to-pointer.  The two types are completely different.

POINTERS AND ARRAYS ARE NOT NOW AND NEVER HAVE BEEN EQUIVALENT IN C.

There are a few special cases under which an object of type `array
N of T' is converted to a value of type `pointer to T', and under which
a declaration of type `array N of T' is converted to a declaration of
type `pointer to T'.  This does not make the types equivalent.  They
are not interchangeable.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list