求助函数指针作为函数参数的问题。
程序代码:
#include <stdio.h> int main(void) { int max(int, int); int min(int, int); int process(int x, int y, int (*p)()); int a; int b; printf("请输入两个数据:\n"); scanf("%d %d", &a, &b); process (a,b,max); printf("max = %d",max); return 0; } int process(int x, int y,int f()) { return f(x,y); } int max(int x, int y) { int z; if(x > y) { z = x; } else { z = y; } return z; } int min(int x, int y) { int z; if (x < y) { z = x; } else { z = y; } return z; }
[此贴子已经被作者于2017-3-31 21:30编辑过]