Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please change the actual swapping logic in the scope of the “if” construct, from

ID: 3725661 • Letter: P

Question

Please change the actual swapping logic in the scope of the “if” construct, from array references to pointers from the above code. This also includes the “temp” identifier. Watch your data typing.

Do not modify the array “m” declaration.

The resulting values in the array “m” will be in descending order. </hint> take the code, compile and link it, run and verify the data in “m” is descending. Then modify one line of code (LOC) to use pointers, comment out the original for reference, compile/link and test. Then change another LOC until all swapping is using pointer identifiers. <hint>

The sorting algorithm is to be left as descending There are two logical bugs, the number do not sort correctl Fix it Comment the code where the bugs where, comment out the original code and Place your solution BELOW the original code t/ main () char wait; short m[1-13,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 [O])-1; i++) j++) for 1=numElements-1; // change (1=0; r(,-1+1; (

Explanation / Answer

Please find my code using pointer.

if(*(m+i) <= *(m+j)) {

temp = *(m+i);

*(m+i) = *(m+j);

*(m+j) = temp;

}