So I came across a post on StackOverflow today that intrigued me. It was a question on reversing two numeric values without the use of additional variable (i.e. temp, or what ever you’d like to call it). The code went as follows:
i = i + j; j = i - j; i = i - j;
Simple, right? Arguably not as simple to pick up on when you don’t know what to look for, but certainly alleviates an additional variable, which I am all for.
Just thought I’d pass this tiny little piece of code along.