switch(表达式){
case 整型常量表达式:语句序列
case 整型常量表达式:语句序列
default:语句序列
}
while(表达式)
语句
for(表达式1; 表达式2; 表达式3)
语句
表达式1与表达式3通常是赋值表达式或函数调用;表达式2是关系表达式。这3个组成部分任意部分都可省略,但分号必须保留。如果在for语句中省略表达式1与表达式3,它就退化成了while循环语句。如再省略表达式2,则认为其值永远为真,即成了死循环。
for(;;){
}
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include <stdio.h> 2 #include <ctype.h> 3 int atoi1(char s[]); 4 int atoi2(char s[]); 5 6 main(){ 7 printf("%d ", atoi2("+111")); //111 8 printf("%d ", atoi2("-111")); //-111 9 printf("%d ", atoi2(" -111")); //-111 10 11 printf("%d ", atoi1("999")); //999 12 printf("%d ", atoi1("-999")); //999 13 return 0; 14 } 15 16 /***将s转换为整数 版本1***/ 17 int atoi1(char s[]){ 18 int i; 19 int n = 0; 20 for(i=0; s[i]!='