在学习指向函数的指针作函数参数的时候出错,求解
#include<stdio.h>#define Int int s;
max(int a,int b){
Int
s=a>b?a:b;
return s;
}
min(int a,int b){
Int
s=a<b?a:b;
return s;
}
add(int a,int b){
Int
s=a+b;
return s;
}
f(int a,int b,int (*p)(int,int)){
Int
s=(*p)(a,b);
return s;
}
void main(){
int i,j,x,n,d;
printf("please input 2 numbers:\n");
scanf("%d%d",&i,&j);
printf("\n");
x=f(i,j,max);
n=f(i,j,min);
d=f(i,j,add);
printf("the bigger is %d\n",x);
printf("the smaller is &d\n",n);
pirntf("the jfda is %d\n",d); //求和,和用英文不会说T-T
getch();
}
为什么?为什么??为什么???为什么!!!!
我要抓狂了T-T