dont do this swap for production code. It is error prone and costly. Overflow may occur. if you love to do this way, use XOR instead, but again not for production code. Use an extra variable will be best