C Programming Reference


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

default

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

This is used with switch statement the default executes when all the cases are failed to match in switch block.

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