//: C03:PointerToFunction.cpp // From Thinking in C++, 2nd Edition // Available at http://www.BruceEckel.com // (c) Bruce Eckel 2000 // Copyright notice in Copyright.txt // Defining and using a pointer to a function #include using namespace std; void func() { 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)(); } ///:~