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

Define the scope of static variables.

845


What is size of union in c?

784


What is Dynamic memory allocation in C? Name the dynamic allocation functions.

962


What is wrong with this declaration?

852


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

878


How can you find out how much memory is available?

830


What is ponter?

1042


How can you tell whether two strings are the same?

1046


write an algorithm to display a square matrix.

2460


Can we declare function inside main?

775


What do mean by network ?

909


What are file streams?

789


What are reserved words?

875


Which node is more powerful and can handle local information processing or graphics processing?

1097


Explain how do you determine a file’s attributes?

833