How to swap 2 variables with out using temporary variable by using a c program?
a=a+b; b=a-b; a=a-b;
a^ = b^ = a^ = b; We can use ^ (x-or) symbol and do some trick to swap two values. But this technique won't work with some compiler implementations.
both are correct
both are wrong
For swapping two variable values with out using temporary variable lot of techniques are there. But below are very well know techniques used. 1.a=a+b; b=a-b; a=a-b; 2. a^ = b^ = a^ = b;
Back To Top