Given 2 numbers and is asked to swap them without using a third variable in C language.

There are many ways to swap 2 numbers without using the third variable.

Using Addition and Subtraction Operator

Using Multiplication and Division Operator

Using XOR Operator

^ – XOR Operator

If you have any doubts then comment below.

Leave a Reply

Close Menu