Better coding style for comparison

0 votes
30 views
asked Dec 19, 2013 in C++ by admin (8,135 points)

1 Answer

0 votes
answered Dec 19, 2013 by Ali

HI

  Always try to compare like 


if ( 0 == i ) 

rather than 

if ( i == 0) 

In this way you can catch error for unintended assignments like 

if ( 0 = i) 

...