#include<iostream> using namespace std; void a(){ cout<<"a\n"; } void b(){ cout<<"b\n"; } int c(int* val){ cout<<"c "<<val<<" "<<*val<<endl; return *val; } void main() { cout<<"\n\nmain\n"; cout<<"main函数地址 "<<main<<endl; cout<<"a函数地址 "<<a<<endl; cout<<"b函数地址 "<<b<<endl; cout<<"c函数地址 "<<c<<endl; int add; cout<<"输入需调用的函数地址:"; cin>>hex>>add; int (*fun)(); fun=(int (*)())add; cout<<"返回值 "<<fun()<<endl; }
<img src="http://img.blog.csdn.net/20140615233008046?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcWluZ2NodW53ZWlsaWFuZw==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />
原文地址:http://blog.csdn.net/qingchunweiliang/article/details/31091045