Thanks, how am I supposed to save and use the "i" variable? Do you have a suggestion of a page that explain it or could you do it?
Thanks, how am I supposed to save and use the "i" variable? Do you have a suggestion of a page that explain it or could you do it?
Yes, I can explain it. You save i by assigning it to another variable after the loop, which I will name howmany. Then, assuming you exercised some agency over your own code, and kept the value of howmany in scope somehow where you sort, you would call qsort() using howmany. This will make it so qsort sorts howmany elements instead of 100, since sorting 100 is wrong and actually causes your output problems.
For the first question: you could always print the value of howmany immediately after you assign i to it, to double check.
I'm going to flip your second question around on you, to make you think more about what you're doing, instead of just waiting for us to spoon feed you line by line. This will help you learn better.
How do you think you can send it to qsort?
Try a few different things and see which ones seem to work.