In real life swapping - XOR Trick vs Temp variable?
Aug 26, 2025 · 2 min read · Introduction When we learn about swapping of 2 variables , we find 2 common methods -1. Using a temporary variable2. Using the xor trick #include <iostream> using namespace std; void swapWithTemp(int &x, int &y){ int temp = x; x = y; y =...
Join discussion