dereferencing function pointers

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Jan 21 06:34:24 AEST 1989


In article <185 at ncr-fc.FtCollins.NCR.COM> dona at ncr-fc.FtCollins.NCR.COM (Don Allingham) writes:
>The above code operates as I would expect, an prints "hello" to the screen.
>However, if ppointer is derefernced only once, as in the following example,
>the program will produces the same results.

Sure, because actually functions are called through pointers to them.
The name of a function in the usual form of function call
	foo(bar);
gets immediately turned into a pointer to the function then the call
is made using that pointer.  The extra * on ppointer in your first
example of calling the function was unnecessary (but valid).

If you find the above surprising, you're not alone!

>%CC-W-CONFLICTDECL, This declaration of "pointer" conflicts
>                with a previous declaration of the same name.

All I can guess is that VMS's <stdio.h> has usurped the identifier
"pointer" to mean something else.  Perhaps it's a typedef for (void*).



More information about the Comp.lang.c mailing list