No cases in switch case : C Programming



No cases in switch case

void main()
{
 int choice = 2 ;
 switch(choice)
  {
  }
}

Explanation :

Consider the above switch case example in C Programming. In this example, we have written the switch case with no cases in switch case

Re-commanded Article : Rules of using switch case | Invalid ways of switch case

No cases in switch case - c programming

We never write such kind of statement because it is not required at all while writing code in C but still syntactically no cases in switch case is allowed.

switch(choice)
  {
  }

In this case switch case would be executed but nothing will be printed on the screen