Nothing!. But, it's a good trick to prevent the common error of writing
if(x = 0)
The error above is the source of a lot of serious bugs and is very difficult to catch. If you cultivate the habit of writing the constant before the ==, the compiler will complain if you accidentally type
if(0 = x)
Of course, the trick only helps when comparing to a constant.
Thursday, April 2, 2009
What is the difference between if(0 == x) and if(x == 0)?
Posted by Raghu Kumar on 6:59 PM
RSS Feed
Twitter
Orkut