Most programmers will have their own library of commonly used snippets of code. One task that appears very often is the exchange of the contents of two variables. The code for this usually looks as follows:
int c;
c=a;
a=b;
b=c;
There doesn't appear to be anything wrong with this, but it does make use of a third variable and this takes up more memory.
Discussion (0 comments)