#include <stdio.h>
int main()
{
int max(int, int);
int min(int, int);
int(*p1)(int, int);
int a, b, c, n;
printf("please enter two numbers:");
scanf_s("%d,%d", &a, &b);
printf("choose 1 or 2 :");
scanf_s("%d", &n);
if (n == 1)p1 = max;
else if (n == 2)p1 = min;
c = (*p1)(a, b);
printf("a=%d
b=%d
", a, b);
if (n == 1)printf("max=%d
", c);
else if (n == 2)printf("min=%d
", c);
return 0;
}
int max(int x, int y)
{
int z;
z = (x > y) ? x : y;
return z;
}
int min(int x, int y)
{
int z;
z = (x < y) ? x : y;
return z;
}
报错内容是:可能使用了未被初始化的本地址指针变量p1
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>