Home > Back-end >  Compile no problem but run out is what is wrong
Compile no problem but run out is what is wrong

Time:12-04

#include
# define MAX 100
Void SelectSort (int array [], int n);
Void main ()
{
An int array (MAX);
Int n, s, q;
Printf (" please input the number of sorts: \ n ");
The scanf (" % d ", & amp; n);
Printf (" please input to sort the data: \ n ");
For (s=0; SThe scanf (" % d ", & amp; Array [s]);

Printf (" selection sort results for: \ n ");
For (s=0; SPrintf (" % d ", array [s]);
}
Void SelectSort (int array [], int n)
{
Int k, q, s, temp;
For (s=0; S{
K=s;/* * k element is used to record the minimum position/
For (q=s + 1; QIf (array [k] & gt; Array [q])
K=q;
Temp=array [s].
Array [s]=array [k].
Array [k]=temp;
}
}
  • Related