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
What do you mean by funtion prototype?
What is the arrow operator in c++?
What are the advantages of c++ over c?
Can you please explain the difference between using macro and inline functions?
What is c++ iterator?
Explain selection sorting. Also write an example.
Describe the advantages of operator overloading?
What is a class definition?
Why is swift so fast?
Who invented turbo c++?
What is the purpose of ios::basefield in the following statement?
What is the purpose of extern storage specifier?
Which operator cannot be overloaded c++?
Can constructor be static in c++?
What is a constructor in c++ with example?