Summary: Program Jumps

Keywords

The keywords for program jumps are break, continue, and goto.

General Comments

The three instructions break, continue, and goto cause program flow to jump from one location of a program to another location.

The break Command

The break command can be used with any of the three loop forms and with the switch statement. It causes program control to skip the rest of the loop or switch containing it and to resume with the next command following the loop or switch.

Example
switch (number)
{
     case  4:  printf("That's a good choice.\n");
               break;
     case  5:  printf("That's a fair choice.\n");
               break;
     default:  printf("That's a poor choice.\n");
}

The continue Command

The continue command can be used with any of the three loop forms, ...

Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.