click on this link......

LinkGrand.com

Friday 25 January 2013

case control structure in c

C provides a special control statement that allows us to handle such cases effectively rather than using a series of 'if' statements.
     
Decision using Switch:

the control statement that allows us to make a decision from the number of choices is called a 'switch' or more correctly a 'swicth' case default. since these three keywords go together to make a 'Control Statement'. The most of them appears as follows:

switch(Expression)
{
        case <constant 1> :
                     do this;
              break;
         case<constant 2> :
                    do this;
              break;
        case<constant n> :
                   do this;
              break;
       default:
            do this;
}

The expression following keyword switch is any 'C' expression that will yield on together value. It could be an integer constant like 1,2,3, or an expression. The keyword case is followed by an integer or character constant. Each constant in each case must be different from all other the "do this" in above form of 'switch' represents any valid 'C' statements.


1 comment:

  1. Can I simply say what a aid to find somebody who really is aware of what theyre talking about on the internet. You undoubtedly know how one can convey a difficulty to light and make it important. Extra individuals must learn this and understand this aspect of the story. I cant believe youre not more popular since you undoubtedly have the gift. casino games

    ReplyDelete