- it would be OK on unsigned types.
- it would be liable to arithmetic overflow on signed types.
- for floating point types, expect both to become corrupted, especially if values differ greatly in magnitude
- utterly hopeless as an approach for any other type.
I would really suggest to use the temp variable to swap two values. Cos the swapping variables without third variable such as using the arithmetic operators. This would really very help only when you wanted to swap unsigned integers. Apart from that it is not a recommended at all. If anything other unsigned integers you need to use the temp variable to swap. But in over all the latter would be efficient way of doing it.