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

What’s the special use of UNIONS?

1205


What is double pointer?

1041


What is the difference between malloc calloc and realloc in c?

1187


Is there a built-in function in C that can be used for sorting data?

1338


Who is the main contributor in designing the c language after dennis ritchie?

1052


Explain how can I avoid the abort, retry, fail messages?

1103


What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?

1102


Tell me what is the purpose of 'register' keyword in c language?

1039


Can a local variable be volatile in c?

1055


Explain how can I manipulate strings of multibyte characters?

1255


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

1223


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

2233


Are comments included during the compilation stage and placed in the EXE file as well?

1127


Write a code on reverse string and its complexity.

1091


a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);

1195