Computer Science, asked by prameelaanil77, 11 months ago

the purpose of default statement in switch statement​

Answers

Answered by MB157232
1

Answer:

Image result for The purpose of default statement in switch statement​

What is the purpose of default statement in switch statement in C++? The switch and case keywords evaluate expression and execute any statement associated with constant-expression whose value matches the initial expression.

Explanation:

Answered by parthivjay
0

Answer:

I will not talk about it specific to C++, but I will speak generally for any switch/case statement:

switch( expression )

{

[case constant-expression:]

. . .

[statement]

. . .

[default:

statement]

}

The switch and case keywords evaluate expression and execute any statement associated with constant-expression whose value matches the initial expression.

If there is no match with a constant expression, the statement associated with the default keyword is executed. If the default keyword is not used, control passes to the statement following the switch block.

Similar questions