i think this is also a suitable tip which can be put in this thread..
always do comparision by putting the constant on the left hand side of the exspression.
e.g.
Code:
if (0 == toCompareVariable) {
/*anything*/
}
is a better programming practice than
Code:
if (toCompareVariable == 0) {
/*anything*/
}
this way even if someone do a typo and write
if (0 = toCompareVariable) ..the compiler will produce an error on compilation itself..and thus we are not supposed to scratch our head finding where is code going wrong in case of
if (toCompareVariable = 0)