View Single Post
Old 03-17-2008, 07:32 AM   #4 (permalink)
QUantumAnenome
Code Monkey
 
Join Date: Mar 2005
Posts: 55
QUantumAnenome is on a distinguished road
Send a message via Yahoo to QUantumAnenome
Almost any pointer will convert to a void *, however a void * will not convert to another pointer type unless you use a typecast. Declaring a pointer to a function is shown below.

Code:
void *x;               // pointer to whatever
void (*fPtr)(int);   // pointer to a function of the form void f(int)

void foo(int)
{
	x = foo;		// No worries here
	fPtr = foo;	// As intended
	fPtr = x;		// Error!
}

Last edited by QUantumAnenome; 03-17-2008 at 07:33 AM. Reason: bad code tags
QUantumAnenome is offline   Reply With Quote