"array" vs. "&array" ?

Chuck Phillips chuckp at ncr-fc.FtCollins.NCR.com
Wed Jan 10 07:27:35 AEST 1990


In article <2378 at ektools.UUCP> randolph at ektools.UUCP (Gary L. Randolph) writes:
>   Am I wrong in the inference from K&R that:

>   float arrf[3] = {1.2,2.3,3.4};
>   arrf;            /*evaluates to pointer to float according to K&R*/

When declaring/defining arrf, space is allocated for a pointer to the array
_in the symbol table_, _not_ in the actual object code.  (i.e.  this address
may not manifest itself in the object code at all if never referenced)

> &arrf; /*evaluates to pointer to pointer to float (my inference)*/

So now, as I understand it, you're asking for a pointer to something that
exists in the symbol table that is often stripped from the final version of
programs.

This doesn't make sense to me, nor does it make sense to several of the
compilers I've used.  Some have printed a message to the effect, "Surely you
must be joking.  I'll ignore the '&' and pretend you just wrote 'arrf', you
naughty, naughty little programmer."

My question: Is this now part of ANSI C?  (Yuk!)


--
	   Chuck Phillips -- chuckp%bach.ncr-fc.FtCollins.NCR.COM



More information about the Comp.lang.c mailing list