Mega Code Archive

 
Categories / C Tutorial / Statement
 

In the absence of a break statement, all statements that are followed by matched cases are executed

#include <stdio.h> main(){         int i= 6;                  switch(i%2)         {             case 0 : printf("the number %d is even \n",i);                         case 1 : printf("the number %d is odd \n",i);                      break;         } } the number 1 is odd the number 2 is even the number 3 is odd the number 4 is even