I am confused by the form of parameters for function pointers. The following two:
int fun(int (*g)())
{
cout << g() << endl;
}
int fun(int g())
{
cout << g() << endl;
}
Both these two definitions work well. But as you have noticed, there are some differences in the prototypes of these two functions:
- the first one takes parameter
int (*g)()
, - while the second takes parameter
int g()
.
My question is are there any difference between them?