C Programming Reference >> C Basic Tutorials >> C Keywords Home >> default 30/12/06 - Views - Ratings : 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");
}
|