C language has two keywords if, else to make decision. If block has one condition or comparison statement which decides if this logic would follow the path of "IF" or "ELSE". Syntax for if-else block is

if (condition )  
  Statement 
else 
  Statement

Or 

if (condition )  {
  Statement (s)
 } else {
  Statement (s)
}

Curly brackets are not needed if only one statement is there. But it is recommended to put Curly bracket to have better readability. Here is

if (condition 1)  {
  Statement (s)
} else if (condition2) {
  Statements (s)
  .............
  .............
} else if (condition n) {
  Statements (s)
} else {
  Statements (s)
}

About our authors: Team EQA

You have viewed 1 page out of 252. Your C learning is 0.00% complete. Login to check your learning progress.

#