while(1){} 与 while(1) 的作用相同吗? [英] Does while(1){} do the same as while(1);
本文介绍了while(1){} 与 while(1) 的作用相同吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想确定这个 C 代码:
I just want to be sure that this C code:
while(flag==true)
{
}
foo();
与此相同:
while(flag==true);
foo();
推荐答案
;
单独是 C 中的 null 语句.
;
alone is a null statement in C.
在您的情况下,{}
或 ;
在语法上是必需的,但它们的作用相同:什么都没有
In your case, {}
or ;
are syntactically needed, but they do the same: nothing
这篇关于while(1){} 与 while(1) 的作用相同吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文