0

Swap

how the swap with one line is executing?? the value for b is OK...and how it is possible for a??

7th Jan 2017, 10:28 AM
vani sri
vani sri - avatar
4 Respostas
+ 7
a=a+b-(b=a); This works in C++, idk for Java
7th Jan 2017, 12:10 PM
Filip
Filip - avatar
+ 7
It swaps the values, for exaple, if a=5 and b=4, when you print it after it will be: a=4 b=5
7th Jan 2017, 12:43 PM
Filip
Filip - avatar
0
you're saying it is gives both values ???
7th Jan 2017, 12:42 PM
vani sri
vani sri - avatar
- 1
am asking how it work???explain the line a=a+b-(b=a);
7th Jan 2017, 12:45 PM
vani sri
vani sri - avatar