Possible Duplicate:
Why do all these crazy function pointer definitions all work? What is really going on?
I would be grateful for an explanation why in the code
void f(int& i)
{
i++;
}
void g(void (passed_f)(int&),int& a) //`passed_f` equivalent to `*passed_f`
{
passed_f(a);
}
int main()
{
int n=0;
g(f,n); //`f` is equivalent to `&f`
}
both of the equivalences hold, in the sense of not producing any errors, and giving exactly the same result, 1
. It seems, that it does not matter if we accept in g
a pointer to a function, or a function itself... I also presume that [c]-tag is appropriate.