I found that this compiles in Microsoft Visual C++ 20开发者_如何学Python10.
void main()
{
int i=9;
while (i>4)
{
i--;
}
while (i>6);
}
Probably not.. the second while does not seems to have an effect
Your
while (i>6);
does not have any effect. It's just a loop with an empty body:
while (i>6)
;
There is nothing unusual about it. It's two while statements, except the other one has an empty body. The bigger problem is void main.
You have two separate while loops here. The second just has an empty body. Reformat to:
int i=9;
while (i>4)
{
i--;
}
while (i>6)
;
...and it might make more sense. In this case, i is 4 upon entry to the second loop, so the second loop never executes.
while (i>6); is no new feature, it simply says that while i is greater than 6 it should execute an empty statement ;.
加载中,请稍侯......
精彩评论