Page 52 - 6437
P. 52

             Not every case needs to contain a break. If no break appears, the flow of
                   control will fall through to subsequent cases until a break is reached.
                                       A switch statement can have an optional default case, which must appear
                   at the end of the switch. The default case can be used for performing a task when none of the
                   cases is true. No break is needed in the default case.

                          Flow Diagram








































                          Example

                 #include <stdio.h>


                 int main ()

                 {
                    /* local variable definition */
                    char grade = 'B';



                    switch(grade)
                    {
                    case 'A' :








                                                                                                      54
   47   48   49   50   51   52   53   54   55   56   57