function casting

Geoff Rimmer geoff at cs.warwick.ac.uk
Mon May 1 13:43:38 AEST 1989


In article <12481 at umn-cs.CS.UMN.EDU> clark at umn-cs.CS.UMN.EDU (Robert P. Clark) writes:

> How do I cast something to a pointer to a function that returns
> an integer?  

The way I use is to imagine I am defining a variable x to be a pointer
to function returning int.  I would use:

	int (*x)();

To change this into a cast, take out the x, and put the whole lot in
parentheses.

	(int (*)())

Get the cdecl program!  It will do all of this for you.

Hope this helps.
Geoff

	/---------------------------------------------------------------\
	|	GEOFF RIMMER  - Friend of fax booths, ANSI C, PCBH,	|
	|			& MPFC & cdecl				|
	|	email	: geoff at uk.ac.warwick.emerald			|
	|	address : Computer Science Dept, Warwick University, 	|
	|		  Coventry, England.				|
	|	PHONE	: +44 203 692320 (10 lines) If I'm out please	|
	|			   leave a message with my secretary.	|
	|	FAX	: +44 865 726753				|
	\---------------------------------------------------------------/



More information about the Comp.lang.c mailing list