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

Answer Posted / dhruv

I am not giving an answer, but just wanted to point out that
most of the solutions which try to add (a+b) and then
subtract from it will not work if (a+b) exceeds the maximum
value an int can hold.

So even if it looks good on paper it will give erroneous
results when run on a machine

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between scanf and gets?

606


Is stack a keyword in c?

632


Is c procedural or functional?

582


write a program to print largest number of each row of a 2D array

1866


What does return 1 means in c?

579






Why can’t we compare structures?

805


What is the role of this pointer?

545


When can you use a pointer with a function?

562


What is an array in c?

589


Explain how do you list a file’s date and time?

615


Explain what is the difference between a string and an array?

628


What are dangling pointers in c?

634


Can stdout be forced to print somewhere other than the screen?

613


What is the right way to use errno?

619


What is a nested loop?

643