how to swap two numbers with out using temp variable

Answer Posted / dd

a=1
b=2
a=a+(b-a)
b=(a+b)-b

Is This Answer Correct ?    12 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are vtable and vptr?

715


Is std :: string immutable?

655


What is a v-table?

753


How can you create a virtual copy constructor?

688


Can you declare an array without a size in c++?

671






What is the use of volatile variable?

689


What does obj stand for?

731


Differentiate between the manipulator and setf( ) function?

704


What can I safely assume about the initial values of variables which are not explicitly initialized?

714


What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?

713


Why do we use vector in c++?

687


What is abstract keyword in c++?

709


What is difference between malloc()/free() and new/delete?

735


Can we declare a base-class destructor as virtual?

660


What is the function of I/O library in C++ ?

761