Hey guys,
Today's class seemed a little confusing to some.
Basically what he was saying is when your casting just take the type and put that in front of the pointer. Here's a simple example...
double example1(int, int, double);
int main()
{
/* Create pointer to a void type */
void (*p);
double holder = 0;
/*Cast pointer of void type to function type wanted */
p = (*(double (*)(int, int, double))p);
/*Let pointer be pointed to function start */
p = example1;
/*Run pointer and hold returned value */
holder = *p(2, 4, 5);
}
Wednesday, June 9, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment