how to swap two numbers with out using temp variable

Answer Posted / guest

another way is using bitwise XOR (^).

a=9; //a=1001
b=5; //b=0101

a=a^b; //a=1100
b=a^b; //b=1001
a=b^a; //a=0101

Is This Answer Correct ?    29 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Of the numbers 12 23 9 28 which would be at the top of a properly implemented maxheap a) 28 b) 9 c) Any of them could be

921


write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;

1504


What is virtual destructor? What is its use?

571


How important is c++?

524


What is the best it certification?

575






Explain the difference between abstract class and interface in c++?

517


Show the application of a dynamic array with the help of an example.

579


Is c++ harder than java?

561


What is c++ & why it is used?

583


What is & in c++ function?

581


What is the difference between a "copy constructor" and an "assignment operator" in C++?

612


Explain polymorphism?

579


What does floor mean in c++?

570


What is implicit conversion/coercion in c++?

642


Name the debugging methods that are used to solve problems?

574