Home > Back-end >  Excuse me why call a function shi, output the function
Excuse me why call a function shi, output the function

Time:12-19

#include
Int main ()
{void Max (int, int);
The void min (int, int);
Void (* p) (int, int);
Int a, b, c, n;
Int flag=1;
P=Max.//to initialize to use
While (flag)
{
Printf (" enter a and b ");
Scanf_s (" % d % d ", & amp; A, & amp; B);
Printf (" choose 1 (Max) or 2 (min) ");
Scanf_s (" % d ", & amp; N);
If (n==1) p=Max.
Else if (n==2) p=min;
Scanf_s (" % d ", & amp; The flag);
}
}
Void Max (int x, int y)
{
int z;
If (x & gt; Y)
Z=x;
The else
Z=y;
Printf (" Max=% d ", z);

}
The void min (int x, int y)
{
int z;
If (x & gt; Y)
Z=y;
The else
Z=x;
Printf (" min=% d ", z);

}

CodePudding user response:

Where is your main function call?

If (n==1) p=Max.
Else if (n==2) p=min;
P (a, b);//append this here, to call a function
Scanf_s (" % d ", & amp; The flag);
  • Related