650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0013.gif "alt=" J_0013.gif "/> True and false judgment
1. Comparison of Boolean variables with 0
You cannot compare Boolean variables with true FALSE 0 or 1.
if (flag==true)//Bad style if (flag==1)//Bad style
The Boolean type represents nonzero as true (true), non-zero is False (false), but true and false do not have a uniform standard when defined, such as true in Visual C + + 1, and 1 in Visual Basic.
if (flag)//is expressed as true if (! Flag)//denotes false
2. Shaping variables and 0 comparisons
Compare directly to 0
if (value==1)//correct style if (value)//bad style, cannot imitate Boolean type style write
3. Floating-point variable versus 0-value comparison
You cannot compare floating point numbers with = = or! = with any number. Due to the limitation of precision, it should be managed to convert to <= or >=
if (X<=epsinon)//epsion i.e. accuracy, allowable error, generally very small
4. Pointer variable versus 0 value comparison
Pointer variables are directly compared to NULL with! = or = =
In the IF statement has bad style and good style, good style written code is simple and easy to understand and beautiful, bad code written out others will think your C language is not standard, appear very low. I hope we all develop a good writing style yo ~650) this.width=650; "Src=" Http://img.baidu.com/hi/jx2/j_0037.gif "alt=" J_0037.gif "/>
This article is from the "incomparable Warm yang" blog, please be sure to keep this source http://10797127.blog.51cto.com/10787127/1757944
Unspoken rules in the IF brackets