函数指针用法(事例)

来源:互联网 发布:夏日甜心直播软件 编辑:程序博客网 时间:2024/05/17 22:19
 

#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;
}