Programming Tools Guide
Chapter 3, C language compiler

Jump statements

Jump statements



goto



   goto identifier;


break

Terminates nearest enclosing switch, while, do, or for statement. Passes control to the statement following the terminated statement. Example:

   for (i=0; i<n; i++) {
      if ((a[i] = b[i]) == 0)
         break;	/* exit for */
   }


continue

Goes to top of smallest enclosing while, do, or for statement, causing it to reevaluate the controlling expression. A for loop's expression3 is evaluated before the controlling expression. It can be thought of as the opposite of the break statement. Example:

   for (i=0; i<n; i++) {
      if (a[i] != 0)
         continue;
      a[i] = b[i];
      k++;
   }


return



   return;
   return expression;