![]() |
Swap two values using XOR operation
Hi all, How we can Swap the two values using XOR operation but without using third Variable?
Thanks |
Re: Swap two values using XOR operation
Very simple
Code:
int x = 1;Thanks Shabbir Bhimani |
Re: Swap two values using XOR operation
Thanks. I was not able to start my PC and so I could not reply.
|
Re: Swap two values using XOR operation
we can do in a single line using compound assignment tooo....:)..
x^=y^=x^=y; the above too will work thank u |
| All times are GMT +5.5. The time now is 16:15. |