Why break statement is used in switch statement in c++?
Answers
Answered by
2
I hope help you
The break statement is used inside theswitch to terminate a statement sequence. When a break statement is reached, theswitch terminates, and the flow of control jumps to the next line following the switch statement. ... The flow of control will fall through to subsequent cases until a break is reached. please mark brain list ♥♥♥♥
The break statement is used inside theswitch to terminate a statement sequence. When a break statement is reached, theswitch terminates, and the flow of control jumps to the next line following the switch statement. ... The flow of control will fall through to subsequent cases until a break is reached. please mark brain list ♥♥♥♥
Answered by
0
Reason to use break statement with switch :
Explanation:
- The switch statement has some cases which are used to match the value and print the result like in this statement "switch(a){case 1: statement}", when the value of a will be 1, then the statement will be executed.
- Suppose there is a two case defined in the sitch statement case 1 and 2, and the variable value will be 1, then the 1 and 2 statement both will be executed.
- But when the user uses a break statement then only case 1 statement will be executed.
Learn More :
- Switch: https://brainly.in/question/1110679
Similar questions