Suppose x, y two integer type variable
If we swapping value x to y and y to x general c/c++ code:
int x,y,temp;
temp=x;
x=y;
y=temp;
Now, optimized code is:
int x,y;
x=x+y;
y=x-y;
x=x-y;
So, we can swapping by using two variables instead of three variables