Did you look at the screenshot you will understand a little bit.
you will see "01211028" when the should be 7 output.
after all the function argument was addition(3,4);
I just told you. Look at your code. Programs execute from top to bottom. Do you call your function in your output statement? No, you call it afterwards. I'm surprised this even runs (unless addition is a void function? Even then it doesn't make sense).
int func()
{return 0;}
int main()
{
int(*pFunc)() = func;
std::cout<<pFunc<<std::endl;
std::cout<<func;
cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
return 0;
}
And as I (unexpectedly) expected, both pFunc and <<func gave the same value (Pointer to func).
Was compiled using MVC++10, and I too am rather confused. Do functions automagically decay to their address pointer when used as a variable?
PSEUDO-EDIT: Looked it up, and apparently function names themselves do decay to the address automatically. Didn't know this.