C Programming Reference


C Programming Reference >> C Basic Tutorials >> C Keywords Home >>

caseui

30/12/06 -  Views - Ratings :   3.48 of 5 / 155 Votes

This statement is used only and only with switch and cannt exist outside the switch block. It is used to represent code related to particular input value to the switch loop. If a break statement is not end of the case the execution continue with next case.

Code -
void function (void)
{
char ch;

printf ("\nYou Entered A");
ch = getchar ();

switch (ch)
{
case 'A' : printf ("You Entered A");
           break;
case 'B' : printf ("You Entered B");
           break;
case 'C' : printf ("You Entered C");
           break;
default : printf ("You Didnot Entered A, B or C");

}

}

Back To Top


      

 

 

© 2006 cencyclopedia.com