Swapping two variable value without using 3rd variable
Posted
by Muhammad Akhtar
on Stack Overflow
See other posts from Stack Overflow
or by Muhammad Akhtar
Published on 2009-12-01T13:22:21Z
Indexed on
2010/04/03
0:53 UTC
Read the original article
Hit count: 614
One of the very tricky question asked in an interview...
we need to swap the values of two variables like a=10 and b=15
Generaly to swap two variables values, we need 3rd variable like..
temp=a
a=b
b=temp
Now the requirement is, swaping value of two variable values without using 3rd variable?
How can be accopmplish this?
© Stack Overflow or respective owner