C++ examples for Data Type:typedef
Using Function Pointers for Callbacks
#include <iostream> bool updateProgress(int pct) { std::cout << pct << "% complete...\n"; return(true); } typedef bool (*FuncPtrBoolInt)(int); void longOperation(FuncPtrBoolInt f) { for (long l = 0; l < 100000000; l++) if (l % 10000000 == 0) f(l / 1000000);/* w w w . ja v a 2 s.com*/ } int main() { longOperation(updateProgress); // ok }