#include <stdio.h>
double f1(double x)
{return x*x;}
double f2(double x, double y)
{return x*y;}
double fun(double a, double b)
{
/**********found**********/
double (*f)();//f是一个函数的指针,且f指向的函数的返回值为double型,函数的指针的定义方式是:类型标识符(*指针变量名)(),所以这的函数的指针的定义为“double”。
double r1, r2;
/**********found**********/
f = f1; /* point fountion f1 *///规定在2处使fa指向函数f1
r1 = f(a);
/**********found**********/
f = f2 ; /* point fountion f2 *///在3处使fb指向函数f2
r2 = (*f)(a, b);
return r1 + r2;
}
main()
{double x1=5, x2=3, r;
r = fun(x1, x2);
printf("\nx1=%f, x2=%f, x1*x1+x1*x2=%f\n",x1, x2, r);
}
04-18
563

12-08
1637

02-04
9139

02-27
570
