I am supposed to do a void that sorts the user's input array ascendingly/descendingly according to the input (true/false).
It works fine on our homework checking system (I have no idea what they're using to test our code though) except for the fact that my output array is always repeating twice,
Ex: supposedly output 1 2 3 4, my output 1 2 3 4 1 2 3 4.
Would really appreciate if anyone can elaborate on what's wrong with my code!
Apologize for my English skill.
@Enoizat thank you for the review! Turned out it was my school's system testcase that was at fault and not mine though, but I really appreciate your help!