Home > Back-end >  For bosses to change
For bosses to change

Time:11-12

Is the function of the following procedures: first, in the main function of the input 10 integers, then the callback function of calculating the maximum number of 10 Numbers and minimum number of final output in the main function, please correct the errors in the program, finally submit complete source program and limit cannot use global variables, () in the level of difficulty:

Tip: use a pointer parameter,


#include
# define N 10
Int max_min (int a [], int n, int * pmin)
{int Max, min,
int i;
Max min==a, [0].
for(i=1; i<=n - 1; I++)
{if (a [I] Max=a, [I].
If (a [I] & gt; Min)/* or else if (a [I] Min=a, [I].
}
* pmin=min;
Return (Max);
}
Int main (void)
{int x [N], Max, min,
int i;
for(i=0; iThe scanf (" % d ", & amp; X [I]);
Max=max_min (x [N], N, & amp; Min);
Printf (" Max=% d, min=% d \ n ", Max, min);
return 0;
}

CodePudding user response:

refer to the original poster provincial public security department says the Li Weimin response:
is the function of the following procedures: first of all, in the main function of the input 10 integers, then in the callback function of calculating the maximum number of 10 Numbers and minimum number of final output in the main function, please correct the errors in the program, finally submit complete source program and limit cannot use global variables, () in the level of difficulty:

Tip: use a pointer parameter,


#include
# define N 10
Int max_min (int a [], int n, int * pmin)
{int Max, min,
int i;
Max min==a, [0].
for(i=1; i<=n - 1; I++)
{if (a [I] Max=a, [I].
If (a [I] & gt; Min)/* or else if (a [I] Min=a, [I].
}
* pmin=min;
Return (Max);
}
Int main (void)
{int x [N], Max, min,
int i;
for(i=0; iThe scanf (" % d ", & amp; X [I]);
Max=max_min (x [N], N, & amp; Min);
Printf (" Max=% d, min=% d \ n ", Max, min);
return 0;
}

No personal look, you are
  • Related