![]() |
How do you write a program in C to swap two variables without using the third one? |
[Edit] |
[Edit]
Answer
- include
- include
Answer
Program for swapping two numbers without using third variable.This programme will work for only integer not for floating.For both the above code is correct one.
fun_swap( int a,int b){ a = a^b; b =a^b; a =a^b; printf( "%d %d", a,b); }
First answer by Prabhu Durairaj. Last edit by sunilkumar Deshpande. Question popularity: 36 [recommend question]
|
Research your answer: |
Can you answer other
questions about software and apps?
- I installed XP after I installed Vista...When I boot my comp it won't give me the option of which OS I want to choose. Anything I can do about this?
- How long does it take to earn a professional degree in computer engineering?
- What is required to be a software engineer?
- How do you edit the values that a program stores in RAM?





