2079 4

CSC115 ยท 2079 ยท 5 marks

How do you swap the values of two integers without using the third temporary variable? Justify with the example.

How do you swap the values of two integers without using the third temporary variable? Justify with the example. [5]

C ProgrammingChapter 4: Operators and ExpressionArithmetic operator

Normally, swapping two variables requires a third temporary variable. However, we can swap two integers without a temporary variable using either: 1. Arithmetic operators (Addition and Subtraction) 2. Bitwise XOR operator --- Step Operation a b ----------------------- Initial -- 10 20 Step 1 a = ...