I am learning C++ and just playing around with function pointers.
I have this very simple program, but I do not get any output when called. Would you mind explaining why? I think it's because inside the printTheNumbers, I never called the function itself I just make a reference to it?
void sayHello()
{
cout << "hello there, I was accessed through another function\n";
}
void accessFunctionThroughPointer(int a, int b, void(*function)())
{
}
int main(int argc, const char * argv[])
{
printTheNumbers(2, 3, sayHello);
return 0;
}
printTheNumbers():function();