Let Us C Solutions
Chapter 5: The Case Control Structure

Let Us C chapter 5 solutions The Case Control Structure

Let Us C Solutions, chapter 5, The Case-Control Structure. This chapter covers the topics of switch case control structure. It is the alias of if-else but has some similarities and differences.

The Switch-Case construct takes a variable, usually, an int or an enum, placed after the switch, and compares it to the value following the case keyword. If the variable is equal to the value specified after the case, the construct "activates", or begins executing the code after the case statement. Once the construct has "activated", there will be no further evaluation of cases.

Typically, the last statement for each case is a break statement. This causes program execution to jump to the statement following the closing bracket of the switch statement, which is what one would normally want to happen. However, if the break statement is omitted, program execution continues with the first line of the next case, if any. This is called a fall-through.


© 2021 Garbage Valuegarbage value logo