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 do we swap or interchange any 2 numbers without using
Temporary variable...Anybody can pls answer it.. Thanks in
Advance

Answer Posted / emperor of america

using bitwise operator works 100%:
x^=y;
y^=x;
x^=y;

using +/- works sometime, need to consider overflow.

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of type specifiers?

1046


Why calloc is better than malloc?

1044


What is a pointer value and address in c?

1135


What is #include called?

1066


What is meant by errors and debugging?

1117


Mention four important string handling functions in c languages .

1116


What is the use of gets and puts?

1035


How do you declare a variable that will hold string values?

1183


What are the advantages of the functions?

1164


What does do in c?

1065


Differentiate between a for loop and a while loop? What are it uses?

1191


can we have joblib in a proc ?

2310


What is switch in c?

1116


How can this be legal c?

1091


Explain what is a stream?

1097