0

what is swap?

4th Jul 2016, 9:37 PM
jegr
jegr - avatar
2 Answers
+ 1
It just swaps two variables. You need to include the algorithm library ( #include <algorithm> ) in order to use it. For example, let's suppose that you want to swap a and b. You should call the function swap: swap ( &a , &b ); or for some compilers swap ( a , b ); Hope that helps.
4th Jul 2016, 9:43 PM
Mihai Dancaescu
Mihai Dancaescu - avatar
+ 1
it means change the value of two number. a=4 b=7 after swap a=7 b=4
5th Jul 2016, 7:09 AM
DEATH WALKER
DEATH WALKER - avatar