case label not within a switch statement

case label not within a switch statement.

Description


The keyword case can appear only in a switch statement.

Example


case label not within a switch statement
case label not within a switch statement

Output


output: case label not within a switch statement
output: case label not within a switch statement

How to fix it ?


The keyword case can appear only in a switch statement.

syntax


switch (<  expression of integer type>) {

case <integer onstant-expression>  :

statement(s);

break; /* optional */

case <integer onstant-expression> :

statement(s);

break; /* optional */

/* you can have any number of case statements */

default : /* Optional */

statement(s);

}

See also


Leave a Reply

Your email address will not be published. Required fields are marked *