**
无限循环语句
**
****了解:
goto无条件跳转
for循环中的()和:不可省略,其余均可省略;for(;;)等价于while(1)for循环表达式1只执行1次。
第一种:
while(1)
{
printf("…\n");
}
.第二种:
for(; ?
{
;
}
第三种:
void main()
{
LOOP:
printf("…\n");
goto LOOP;
}
注意
char c=1;
int s=0;
while(c<151)
s+=c++;
是一个死循环,因为char为-128-127到不了151
int c=1;
int s=o;
while(c<151)
s+=c;
c++;
也是一个死循环,因为当循环多条语句时,需要把语句括起来
int i=0;
while(i<100)
{i–;}
是一个伪死循环