Thank you for the opportunity to help you with your question!
Let me explain to you this part so that you can understand better.
This program is meant to perform a sort and so the part is the one which does the sorting.
The Array stud contains Data which is being compared and so, if the the value stored at stud[i] is less than the value stored at stud[j] * which is the same as i +1 then the value is held up in a temporary variable called t and the value of stud[i] is changed to the what was initially the value of stud[j]. After it has been changed, then we change the value of stud J to the value we assigned to t.
The reason why we assign it to another variable, is because we are doing an actual replacement to the variables therefore making it impossible to just assign it directly.
Assume you have this data as the data in the Array:
Assume we are at position 5 where the value is 9 . The value of stud[j] is 5 which is smaller.
We want to swap positions so that 5 comes to the stud while 9 goes to stud
Please let me know if you need any clarification. I'm always happy to answer your questions.
Dec 4th, 2015
Did you know? You can earn $20 for every friend you invite to Studypool!