際際滷

際際滷Share a Scribd company logo
ANSI C
Language
C Language Basics
Lection 10
弌仂亟亠亢舒仆亳亠
 仗亠舒仂 switch
 弌亳仆舒从亳
 亳仄亠
 弌舒于仆亠仆亳亠 if 亳 switch
23.05.2019 0:31 Introduction 2
仗亠舒仂 switch
弌亳 亳仄亠亠 仂仗亠舒仂 仗亳仆亳 亠亠仆亳亶
switch, 于仗仂仍仆ム亳亶 亟亠亶于亳,
仂仆仂于于舒 仆舒 舒于仆亠仆亳亳 亰仆舒亠仆亳 仂
仗亳从仂仄 从仂仆舒仆 亳仄于仂仍仂于 亳仍亳 亠仍
亳亠仍. 亳 仂弍仆舒亢亠仆亳亳 仂于仗舒亟亠仆亳
于仗仂仍仆磳 仂仗亠舒仂 亳仍亳 仂仗亠舒仂,
舒仂亳亳仂于舒仆仆亠  亟舒仆仆仄 亰仆舒亠仆亳亠仄.
23.05.2019 0:31 Introduction 3
弌亳仆舒从亳
4
亳仄亠 #1
5
亳仄亠 #1
6
亳仄亠 #2
7
亳仄亠 #2
8
亳仄亠 #3
9
弌舒于仆亠仆亳亠 if 亳 switch
10
1. Check the Testing Expression:
if-then-else statement can test expressions.
2. Switch better for Multi way branching.
3. if-else better for boolean values.
4. Speed:
switch statement might prove to be faster.
5. Clarity in readability:
A switch looks much cleaner.
switch vs if else

More Related Content

C language lect_11_basics