C++ examples for Function:Function Pointer
Using a function pointer
#include <iostream> using namespace std; void func() {//from w w w . j av a 2 s . com cout << "func() called..." << endl; } int main() { void (*fp)(); // Define a function pointer fp = func; // Initialize it (*fp)(); // Dereferencing calls the function void (*fp2)() = func; // Define and initialize (*fp2)(); }