Home > Back-end >  Beginners, write a function to find the maximum and the minimum
Beginners, write a function to find the maximum and the minimum

Time:09-23

Beginner c, why want to ask everyone this code min's output is wrong

#include
Int Max (int a []);
Int Min (int a []);
Int main ()
{
Int I, a [10], Max, min,
for(i=0; i<10; I++)
The scanf (" % d ", & amp; A [I]);
Max=Max (a);
Min=min (a);
Printf (" Max=% d, min=% d \ n ", Max, min);
return 0;
}

Int Max (int a [])
{
Int I, Max.
for(i=0; i<10; I++)
If (a [I] & gt; Max)
Max=a, [I].
The return of Max;
}

Int Min (int a [])
{
Int I, min;
for(i=0; i<10; I++)
If (a [I] Min=a, [I].
Return min;
}

CodePudding user response:

Max uninitialized
 int Max (int a []) 
{
Int I, Max.
Max=a, [0].
for(i=1; i<10; I++)
If (a [I] & gt; Max)
Max=a, [I].
The return of Max;
}

CodePudding user response:

The
reference 1/f, the truth is more important than right or wrong response:
Max uninitialized
 int Max (int a []) 
{
Int I, Max.
Max=a, [0].
for(i=1; i<10; I++)
If (a [I] & gt; Max)
Max=a, [I].
The return of Max;
}

thank you very much!!

CodePudding user response:

The original poster is min, min and Max initialization,