Friday, July 29, 2016

C Basics - Forms of if Statement in C

The if statement can take any of the following forms:

if ( condition ) do this ; 

if ( condition ) 
  do this ;

if ( condition ) { 
  do this ; 
  and this ; 
}

if ( condition ) do this ; 
else 
  do this ; 

if ( condition ) { 
  do this ; 
  and this ; 
} 
else 
{ 
  do this ; 
  and this ; 
} 


if ( condition ) do this ; 
else 
{ 
  if ( condition ) 
    do this ; 
  else 
  { 
    do this ; 
    and this ; 
  }  
} 

if ( condition ) { 
  if ( condition ) 
    do this ; 
  else 
  { 
    do this ; 
    and this ; 
  } 
} 
else 
  do this ; 



Related topics:
Overview of Statements in C   |   Decision Making Statements in C   |   The if Statement in C   |   The if-else Statement in C   |   The else-if Statement in C   |   Nested if-else Statement in C   |   Switch Statement in C   |   Conditional Operator Statement in C   |   The null Statement in C

List of topics: C Programming

No comments:

Post a Comment