Write a program to swap two numbers without using third variable in c?



Write a program to swap two numbers without using third variable in c?..

Answer / Chhavi Sharma

In C programming, you can swap two numbers (a and b) without using a third variable by performing bitwise XOR operation: a ^= b ^= a ^= b

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

wat is output of the following int main() { const int j=2; int i; switch(i) { case 1:break; case j:break; default:break; } }

2 Answers  


what is the similarities between. system call and library function?

1 Answers   Wipro,


What does volatile do?

1 Answers  


What is volatile

2 Answers  


Write a c program to print the even numbers followed by odd numbers in an array without using additional array

1 Answers   Tech Mahindra,


Output for following program using for loop only * * * * * * * * * * * * * * *

3 Answers  


A B C D E F G F E D C B A A B C D E F F E D C B A A B C D E E D C B A A B C D D C B A A B C C B A A B B A A A

2 Answers  


When should the volatile modifier be used?

1 Answers  


What is the mean of this statement:: if(int i=0 * i=9)

2 Answers   HCL,


how to execute a program using if else condition and the output should enter number and the number is odd only...

1 Answers  


What does the message "automatic aggregate intialization is an ansi feature" mean?

1 Answers  


What is modifier & how many types of modifiers available in c?

1 Answers  


Categories