Home > Back-end >  About the selection,
About the selection,

Time:11-30


Why haven't learned a pointer, the first way will go wrong, the main function here is no problem,

CodePudding user response:

First swap is the parameter value transfer way, the last one is the manner in which the address, the value transfer and the address is different, the books

CodePudding user response:

Other aside, you swap function is passed by value, performed after is no effect,
Swap passed by address or passed by reference (recommended),
The second line to
Void swap (int & amp; A, int & amp; B)
Have a try?

CodePudding user response:

According to the address, the understanding is not very deep
But I look at the last picture swap should be no problem (your computer tried address passing parameters in exchange for an array element)
Now think if it really is made to the practice of the last picture did not result...
When you look at the function selection_sort call if you have any questions about?