write a program to swap Two numbers without using temp variable.
Answer Posted / yash paranjape
a=a^b;
b=a^b;
a=a^b;
i.e
a^=b;
b^=a;
a^=b;
more simplifie i.e in just one line
a^=b^=a^=b;
This also works fine
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
When is a void pointer used?
Explain what are multidimensional arrays?
Write a program for Overriding.
What is volatile variable in c?
What is the difference between local variable and global variable in c?
What is signed and unsigned?
What are the advantages of union?
What does dm mean sexually?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
How is a structure member accessed?
Write a C program in Fibonacci series.
Is linux written in c?
Can you pass an entire structure to functions?
What is malloc return c?
How can I invoke another program or command and trap its output?