Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Describe the setting up of my member functions to avoid overriding by the derived class?

1132


What is endl?

1151


What is type of 'this' pointer?

1058


What are its advantages and disadvantages of multiple inheritances (virtual inheritance)?

1193


Can a Structure contain a Pointer to itself?

1131


Can a built-in function be recursive?

1022


What is a stack? How it can be implemented?

1168


What is a dynamic binding in c++?

952


How does the copy constructor differ from the assignment operator (=)?

1141


How do you clear a map in c++?

1121


What is polymorphism and its type in c++?

1069


Difference between declaration and definition of a variable.

1140


What is the keyword auto for?

1033


Difference between class and structure.

1159


What is boyce codd normal form in c++?

1156