How do we swap or interchange any 2 numbers without using
Temporary variable...Anybody can pls answer it.. Thanks in
Advance

Answer Posted / raghuram.a

int x,y;

x =x-y;
y =y+x;
x =y-x;

or

int x,y;

x=x^y;
y=x^y;
x=x^y;

Is This Answer Correct ?    11 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I read/write structures from/to data files?

554


Differentiate between static and dynamic modeling.

623


What are global variables and explain how do you declare them?

582


Can we access array using pointer in c language?

650


What is the right type to use for boolean values in c? Is there a standard type?

568






What is c system32 taskhostw exe?

596


What does the function toupper() do?

661


exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above

667


Explain spaghetti programming?

684


What would be an example of a structure analogous to structure c?

578


Tell me the use of bit field in c language?

631


Is array a primitive data type in c?

581


How was c created?

591


Explain how can you tell whether a program was compiled using c versus c++?

581


Can you mix old-style and new-style function syntax?

666