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...

write a program to swap Two numbers without using temp variable.

Answer Posted / guest

using xor technique is much faster than using addition and
subtraction process , and xor instruction is much simpler at
processor level.

so be simply

x = x xor y
y = x xor y
x = x xor y

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain enumerated types in c language?

1045


What are pointers?

1101


Which is better between malloc and calloc?

1198


What is structure of c program?

1157


How main function is called in c?

1121


What is sorting in c plus plus?

971


What is the function of this pointer?

1328


What is the explanation for prototype function in c?

975


what do you mean by inline function in C?

1051


Explain what are bus errors, memory faults, and core dumps?

1271


What is the difference between variable declaration and variable definition in c?

1054


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1721


What is spaghetti programming?

1127


What is the purpose of realloc()?

1139


What is the difference between ā€˜g’ and ā€œgā€ in C?

3994