C using If statement efficiently




[crosslist]

  • Whenever condition is evaluated and Results in Non-Zero Value then Condition is Considered as TRUE
  • Condition is treated as FALSE , if Result of Expression is Negative / Zero
  • Generally 1 indicates TRUE , 0 indicates FALSE value
  • Opening and Closing braces are not required if there is only one Statement after if.
  • Opening and Closing braces are not required if there is only one Statement after else.
  • Block followed after if and before else is called “if block”
  • if there is no statement after else then else can be dropped
  • More than one Conditions can be Combined inside if
  • Nested Control Statements are allowed
  • ! Operator Reveres the Value of Expression
  • Logical && operator indicates “both Conditions must be TRUE”
  • Logical || operator indicated “Either Conditions must be TRUE”

[/crosslist]