原文地址:http://www.cnblogs.com/mlj318/archive/2011/11/02/2233106.html
在VC 6.0 环境中调试程序出现错误
error C2440: 'initializing' : cannot convert from '' to 'void (__cdecl *)(int,int,...)'
None of the functions with this name in scope match the target type
将PF pfun = add; 修正为 PF pfun = (void (__cdecl *)(int,int,...))add;
修正结果为下面代码中显示:
#include <stdio.h>
#include <stdlib.h>
typedef void (* PF)(int,int,...);
void add(int a,int b,int *result)
{
*result=a+b;
printf("result:%d\n",*result);
}
void main()
{
int x,y,z;
PF pfun = (void (__cdecl *)(int,int,...))add;
x=5;
y=4;
pfun(x,y,&z);
}