default’ label not within a switch statement

default’ label not within a switch statement.

Description


The keyword default can appear only in a switch statement.

Example


'default' label not within a switch statement
‘default’ label not within a switch statement

Output


output: 'default' label not within a switch statement
output: ‘default’ label not within a switch statement

How to fix it ?


The keyword default 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


Subscribe to our channel.

Leave a Reply

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