benlue Moderator Reputation: 0
Joined: 09 Oct 2006 Posts: 2142
|
Posted: Tue Mar 13, 2007 1:57 am Post subject: Function Pointers |
|
|
Function pointers are variables that refer to a function and can CALL that function .
Code: | int set_number(int a, int *b);
//The type matches function return type, and the types in back
//match argument list.
int (*funcpointer)(int, int *);
//Assign function to pointer.
funcpointer = set_number;
//call the function
int a = (*funcpointer)(5, &someint);
|
Script i learnt ages ago .
TIPS: Classes help .
Code: | void (Class::*Draw)(float); | That code creates a pointer to the class you used .
( Outdated tutorial ? Add updates here and i will post it into my original post ) |
|