137、写出下列代码的输出内容
#include<stdio.h>
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* INCp = &inc;
int temp = INCp(arg1);
fun(&temp,&arg1, arg2);
printf("%d\n",*arg2);
}
int main()
{
int a;
show(multi,10,&a);
return 0;
}
show的第一个参数是函数指针,传过去的是multi函数的地址
FUNC1* INCp = &inc;吧inc函数地址付给INCp,所以tmp = 11;
所以fun(&temp,&arg1, arg2);等价于multi(&temp,&arg1, arg2);
*c = *a**b等价于 *c = (*a)*(*b)=110