#include double foo(int x , bool y) { if ( y ) x *= 2; else x *= 3; return x + .52; } int main(int argc, char** argv) { // declare a function pointer named ptr that returns a double and takes an int and bool argument double (*ptr)(int, bool); // assign the address of the function to the pointer ptr = foo; // call foo via the function pointer std::cout << ptr(5, true) << std::endl; // declare a reference to a function double (&ref)(int, bool) = foo; // call foo via the reference to function std::cout << ref(6, false) << std::endl; return 0; }