write a program to swap Two numbers without using temp variable.
Answer Posted / jaspreet singh
hey prasanna the program you hv writen is correct but this
method fails when we give the input as a=32767 and b=1
the correct method is
a^=b^=a^=b
or
a=a^b;
b=a^b;
a=a^b;
it will always return the correct answer even if the input
is a=32767 and b=1...............
| Is This Answer Correct ? | 17 Yes | 17 No |
Post New Answer View All Answers
Is anything faster than c?
What do you mean by keywords in c?
What is the best way to comment out a section of code that contains comments?
What is %g in c?
Where static variables are stored in c?
What are two dimensional arrays alternatively called as?
Is printf a keyword?
Is c call by value?
What are operators in c?
What are unions in c?
Explain the difference between malloc() and calloc() function?
What is the meaning of && in c?
What is the difference between typedef struct and struct?
what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)
Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?