In C ProgrammingDecember 2, 20182204 Views Smita Debata
Swapping means interchanging.
Let’s consider two variables x=10 & y=20. After swapping it will become x=20 and y=10.Here x & y value’s are interchanged.
There are various methods to swap two numbers. Here we are going to discuss some of the methods.
To swap two numbers using third variable we have to declare a temp variable.
temp=x; //contains of x will be assigned to temp
Again y value we will assign to x .x value will be replaced with y value.
x=y;