求助!很简单的指针应用,却提示错误!
函数指针作为函数参数的问题#include<stdio.h>
int max(int a,int b)
{
return a>b?a:b;
}
int min(int a,int b)
{
return a<b?a:b;
}
int getvalue(int (*p)(),int a,int b)
{
return (*P)(a,b);
}
main()
{
printf("The max of 3 and 4 is %d\n",getvalue(max,3,4));
printf("The min of 3 and 4 is %d\n",getvalue(min,3,4));
}
再编译的时候提出警告
C:\Documents and Settings\Ever\桌面\c\函数指针作为函数的参数.c(12) : error C2064: term does not evaluate to a function
C:\Documents and Settings\Ever\桌面\c\函数指针作为函数的参数.c(12) : warning C4033: 'getvalue' must return a value
望高手指点 谢谢!呵呵