Pointers to functions
Stephen Clamage
steve at taumet.com
Thu May 16 01:39:47 AEST 1991
aj3u at wilbury.cs.virginia.edu (Asim Jalis) writes:
>What is the difference between these two (pf is a pointer to a
>function, and hello is a function):
>pf = hello;
>and
>pf = &hello;
There is no difference. The oddity is this: A function designator
appearing in an expression context is replaced by the address of the
function, making a pointer-to-function. Attempts to take the address
of the function designator are ignored. So
hello
&hello
&&&&&&&&&&&&&&&&hello
are all equivalent.
Similarly, when you dereference a pointer-to-function, you get a
function designator, which is replaced by pointer-to-function.
Consequently,
pf()
(*pf)()
(****************pf)()
are all equivalent.
--
Steve Clamage, TauMetric Corp, steve at taumet.com
More information about the Comp.lang.c
mailing list