I have been reading about function pointers and about using them as parameters for other functions. My question is how would you pass a function by reference without using p
#include using namespace std; void doCall( void (&f)(int) ) { f( 42 ); } void foo( int x ) { cout << "The answer might be " << x << "." << endl; } int main() { doCall( foo ); }
Cheers & hth.,