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
Can c++ be faster than c?
What is the average salary of a c++ programmer?
Evaluate as true or false: !(1 &&0 || !1) a) True b) False c) Invalid statement
What is the exit function in c++?
Define the operators that can be used with a pointer.
How to demonstrate the use of a variable?
How important is c++?
What is the C-style character string?
Is python better than c++?
When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?
What number of digits that can be accuratly stored in a float (based on the IEEE Standard 754)? a) 6 b) 38 c) An unlimited number
What does it mean to declare a member function as static?
What are disadvantages of pointers?
List different attributes in C++?
Write a short code using c++ to print out all odd number from 1 to 100 using a for loop