Case Control satements

The statements which are used to execute only specific block of statements in a series of blocks are called case control statements.

There are 4 types of case control statements in C language. They are,

  1. switch
  2. break
  3. continue
  4. goto

Program On switch Case Statement

switch_flowchart

Output

switch-output

break Statement

  • Break statement is used to terminate the while loops, switch case loops and for loops from the subsequent execution.

Syntax

break;

Flowchart For break

break-flowchart

Program On break Statement

freah2fresh.com example

Output

continue Statement

  • Continue statement is used to continue the next iteration of for loop, while loop and do-while loops.  So, the remaining statements are skipped within the loop for that particular iteration.

Syntax

continue;

Flowchart For break

continue-flowchart

Program On continue Statement

Output

goto Statement

The goto statement is known as jump statement in C language. It is used to unconditionally jump to other label. It transfers control to other parts of the program.

It is rarely used today because it makes program less readable and complex.

Syntax

{
         …….
         goto label;
         …….
         …….
         label:
         statements;
}

Flowchart For goto Statement

goto-flowchart

Program On goto Statement

Output