c++中函数指针作为int传递

int f()
{
    return 0;
}

typedef int (*method)();

int _tmain(int argc, _TCHAR* argv[])
{
    int value = (int)&f;
    std::cout << value << std::endl;

    method fm = (method)value;

    int x = fm();

    cout<<"over"<<endl;
    int a;
    cin>>a;

    return 0;
}

 

posted on 2019-02-18 17:05  空明流光  阅读(486)  评论(0编辑  收藏  举报

导航