Effective use of ==This tip submitted by Er.Nathan on 2006-11-30 23:47:28. It has been viewed 3816 times.
Rating of 6.4 with 14 votes
Use if statements like this if( 1 == count ) insteed of like this if ( count == 1).
In case if you mistakenly put in just a single = signin the second case, like this:
if( count = 1) //count will be assigned with 1
whereas if you made the same mistake with the constant value first:
if( 1 = count ) //Will give Error
Help your fellow programmers! Add a tip!
Want to become a C++ programmer? The Cprogramming.com ebook, Jumping into C++, will walk you through it, step-by-step. Get Jumping into C++ today!