ashvish183 / Hactoberfest2023

Add any code of DSA
13 stars 233 forks source link

Bitwise_Swap.cpp #159

Open ADARSH-863 opened 1 year ago

ADARSH-863 commented 1 year ago

This C++ program swaps the values of two variables without using a temporary variable, employing bitwise XOR operator. By XORing the variables, it toggles their values, allowing for an efficient and concise way to perform the swap operation. This method showcases the power of bitwise operators in performing tasks without the need for additional memory space.