// name: Fun.cpp // desc: example showing function pointer usage #include using namespace std; // our function int funfunfun( int a, float b ) { // perhaps not so fun... return (int)( a + b*2 ); } // defining a new type called 'FUN_TYPE' typedef int (* FUN_TYPE)( int a, float b ); // entry point int main( int argc, char ** argv ) { // declare a FUN_TYPE variable, store address of funfunfun() FUN_TYPE pf = &funfunfun; // call funfunfun via pf cerr << pf( 3, 5 ) << endl; return 0; }