Coding Reference

C
   Comments
   Flow Control
   Logical Operators
   Preprocessor Directives
   Types
C Libraries

Flow Control

CONDITIONAL STATEMENTS

if ( logical check )
{
     // may be replaced with single statement
}
else if ( logical check )
{
     // may be replaced with single statement
}
else
{
     // may be replaced with single statement
}

switch ( expression )
{
     case constant expression:
          statements;
     break; //return could also be used;

     case constant expression: //drop through
     case constant expression:
          statements;
     break;

     case constant expression:
          statements;
          //drop through
     case constant expression:
          statements;
     break;

     default:
          statements executed on non-match;
          break;
}

//cases and default may be placed in any order.


LOOPS

in loops:
     break will stop the loop
     continue will skip the rest of the body of the loop

for ( initial statement ; logical check ; incremental statement )
{
     // may be replaced with single statement
}

while ( logical check )
{
     // may be replaced with single statement
}

do
{
     // statements
} while ( logical check );


GOTO

goto label;
...

label:
Ad Placement
contact me | terms of use | copyright