8 Years never needed a function pointer and I can't find a good example.
#include
using namespace std;
// Basic Function
int AddOne(int a)
{
return a + 1;
}
// I want a function that returns a pointer to AddOne so I can call it
// This declaration does not work, what is the delcaration to return the function as a pointer.
int (*)(int) GiveMeFunctionPointer()
{
return &AddOne
}
void main()
{
int (*foo)(int) = &AddOne // Cool foo is a pointer to a function taking an int
int (*foo2)(int) = GiveMeFunctionPointer(); // This is what I want to use...
cout << foo(2);
system("pause");
}