现在的位置: 首页 > 综合 > 正文

函数指针用法(事例)

2013年10月08日 ⁄ 综合 ⁄ 共 257字 ⁄ 字号 评论关闭
 

#include "stdafx.h"

#include "stdio.h"
#include "stdlib.h"

typedef int (*func)(int i);

int f1(int n)
{
 printf(" the data is %d/r/n",n);
 return 1;
}
int func2(func temfu)
{
 temfu(2);
 return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
 func temfu = f1;
 func2(temfu);
 system("pause");
 return 0;
}

抱歉!评论已关闭.