address of function

Karl Heuer karl at haddock.ima.isc.com
Tue Jun 13 11:34:24 AEST 1989


In article <370 at msor0.UUCP> kt at msor0.UUCP (Keith Tizzard) writes:
>... and does ANSI permit the following ?
>	int	this[100], *that = &this;
>I was under the impression that there was a symmetry between functions and
>arrays.

The symmetry you're looking for is there, but your example isn't analogous to
Maarten's.  It does work to write
	int  this[100], (*that)[100] = &this;
which is analogous to
	int  foo(void), (*bar)(void) = &foo;

This particular symmetry holds only if the explicit "&" is used.  Writing
"this" without the ampersand yields the same as "&this", but writing "foo"
without the ampersand yields "&foo[0]", which is not the same as "&foo".
(Though they will compare equal if brought to a common type.)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list