Original Post
I am a bit confused when it comes to using function pointer's syntax. The code below uses 2 different ways of calling the Print() method. How can the 2nd method be syntacticly correct?
#include <iostream>
using namespace std;
int main()
{
void (*ptr)(); //pointer to a function
void Print();
ptr = Print;
(*ptr)(); //calls Print()
ptr(); //calls Print() as well!
return 0;
}
void Print()
{
cout << "Hello World\n";
}