Question: /* The sorting algorithm is to be left as descending There are two logical bugs, the number do not sort correctly Fix it Comment the
/*
The sorting algorithm is to be left as descending
There are two logical bugs, the number do not sort correctly
Fix it
Comment the code where the bugs where, comment out the original code and
Place your solution BELOW the original code
*/
main()
{
char wait;
short m[]={3,5,7,2,5,1,2,2,
6,5,7,2,4,1,3,3,
7,7,3,2,5,7,1,9};
unsigned char temp, i, j;
unsigned char numElements = sizeof(m)/sizeof(m[0])-1;
for (i=0; i { for(j=i+1; j { if ( m[i] <= m[j]) { temp = m[j]; m[i] = m[j]; m[j] = temp; } } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
