Possible Duplicate:
How to print function pointers with cout?
What is the difference between function pointers in c and c++? When I'm printing function pointer in c++ it's giving 1, but in c it's giving an address.
#include <iostream>
int fun()
{}
typedef int (*f)();
int main()
{
f test = fun;
std::cout << reinterpret_cast<f>(test);
}
#include <stdio.h>
int fun()
{}
int (*f)();
int main()
{
f = fun;
printf("%p", f);
}