0
int inc(int a)
{
return (++a);
}
int Multi (int *a, int *b, int *c)
{
return (*c = *a**b);
}
typedef int(FUNC1) (int in);
typedef int(FUNC2) (int *, int *, int *);
void Show (FUNC2 fun, int arg1, int *arg2)
{
FUNC1 p = &inc; //this sentence can't access a pointer of a function
int temp = p(arg1);
fun (&temp, &arg1, arg2);
cout<<(*arg2)<<endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
int a;
Show(Multi,10,&a);
return 0;
}
Thx for your help.Yes,它是正確的,我想使用函數指針。如果使用定義typedef int(FUNC1)(int),則返回 ; 並應使用此方法調用.FUNC1 * P = &inc; –