current position:Home>Using pointer method: input three integers ABC and output them in order of size

Using pointer method: input three integers ABC and output them in order of size

2022-02-03 00:33:34 CSDN Q & A

Using pointer method to realize : Enter three integers abc Output... In order of size




Refer to the answer 1:

1、 Exchange the values of two variables through pointers
By pointer a、b Two variables are interchangeable , If you arrange them in descending order , send a、b in a For large values .
2、 Bubble sorting
Output a、b、c

If you don't need to change the value of the original variable , Only through the pointer to achieve the sorting of three numbers , It should be simpler .




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202030033331369.html

Random recommended