C Notes (4) - C statements and program flow

Select structure

 

if (expression) / * expression is established if the statement is executed, else the statement is executed 2 * / 

statement 1 

the else 

statements 2 

 

switch (expression) / * First calculate the value of the expression * / 

Case 1 constant expression: statement 1; 
Case 2 constant expressions: sentence 2; 
Case 3 Constant expressions: sentence 3; 
... ... 
Case constant expressions n : statement n-; 
default: statement. 1 + n-; 
}

Loop structure

while (expression) 

loop statement 

 

do 

loop statement 
} while (expression); 

 

for (initialization expression; Analyzing expression; updating expression) 

loop statement 

Guess you like

Origin www.cnblogs.com/mirocle/p/12115717.html