Switch case and Continue statement

  • Syntax:
           switch (Expression/Variable)
                case label : statements;
                case label : statements;
                default: statement;
  • Used in menu driven Programs.
  • If we don’t put a break in the case, Complier doesn’t generate error same as default.
  • The break statement is useful for coming out from switch-case.
  • We can write default anywhere in the program but we have to write “break” after it.


     int num;
     printf("Enter the number : ");

           case 1: printf("1 \n");
           case 2: printf("1 \n");
           case 3: printf("1 \n");
           default:printf("default ... \n");
     printf("Thanks ... \n");
  • In one switch case, we cannot write two or more default case otherwise it gives an error.
  • We can write in nested switch case.

Return statement:

  • We can use return statement also at last of the program or anywhere in the program to return any specific value of the variable.
  • There are two types of Return statements:
  • 1. Control return and
  • 2. Value return.
  • Useful in coming out of function loop.


Continue Statements:

  • It should be within the loop.
  • For a break, it should be within the loop or switch – case.




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: