A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case.
#GATE_2021, #GATE , #GATE_PREPARATION
When the variable being switched on is equal to a case, the statements following that case will execute until a break statement is reached.
When a break statement is reached, the switch terminates, and the flow of control jumps to the next line following the switch statement.
Not every case needs to contain a break. If no break appears, the flow of control will fall through to subsequent cases until a break is reached.
A switch statement can have an optional default case, which may or may not appear at the end of all the cases. The default case can be used for performing a task when none of the cases is true.
No break is needed in the default case if the default is the last statement.
If the default case is used in between the cases even then it will work perfectly fine but in that case use of break, a keyword is necessary required.
#GATE_2021, #GATE , #GATE_PREPARATION , #focalpoint , #gateexam, #gate_cs , #focalpoint , #gateexam , #gate_cse
Gate cse videos
Sur cette page du site, vous pouvez voir la vidéo en ligne Switch case Example in C durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur focal point 13 août 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 21 fois et il a aimé 2 téléspectateurs. Bon visionnage!