pointers to functions

JOYE,WILLIAM A wj4 at prism.gatech.EDU
Thu Aug 31 06:59:28 AEST 1989


Ok, C gurus of the world... is the following code portable and why or why
not? This code compiles and runs correct on gcc, Mac AUX cc, Ultrix cc,
and Mac MPW c. 

extern void printf;

main()
{
	void (*f)() = printf;

	f("Hello, world\n");		/* are these two methods equivalent? */
	(*f)("Hello, world again\n" );
}


JOYE,WILLIAM A
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!wj4
Internet: wj4 at prism.gatech.edu
-- 
JOYE,WILLIAM A
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!wj4
Internet: wj4 at prism.gatech.edu



More information about the Comp.lang.c mailing list