欢迎访问:常州市武进区嘉泽中心小学网站 !今天是:
栏目列表
您现在的位置是:首页>>教师>>计算机技术>>程序设计>>杂项>>文章内容
C++ 函数指针调用方式
发布时间:2008-11-20   点击:   来源:本站原创   录入者:佚名
 

// test12.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

void func(int i)
{
 printf("This is for test %i\r\n", i);
}

typedef void (*PFUNC)(int);

struct FUNC
{
 PFUNC pfunc;
};

void callfunc(void pfunc(int), int i)
{
 pfunc(i);
}

int main(int argc, char* argv[])
{
 void (*pfunc)(int);
 pfunc = &func;
 pfunc(1);

 callfunc(pfunc, 2);
 
 FUNC sfunc;
 sfunc.pfunc = &func;
 sfunc.pfunc(3);

 return 0;
}

 


附件:
    关闭窗口
    打印文档
    账号登录
    保持登录 忘记密码?
    账号与武进教师培训平台同步