I am trying to do something like
#include <iostream>
using namespace std;
void foo () {
void (*fooptr) (void) = foo;
cout << fooptr << endl;
}
int main () {
void (*fooptr) (void) = foo;
foo ();
return 0;
}
My intent is to see the value of function pointers. If I look up for the address of any function in the main ()
function it makes sense that the function isn't called, It might have not been allocated the memory in the function call stack. But when I call the function and try to see the value of pointer. It still shows the same result 1
. Any explanation?
I might not be printing the address of the called function itself. Is there any pointer like this
like we have in classes. So that we can see the address of itself?