繁体   English   中英

当我们使用do-while循环并在用逗号分隔的while循环中写入常量时,无法预测输出

[英]unable to predict the output when we use do-while loop and write constants in while loop seperated by comma

int i=40;         //defined    
int main()
{
    do
    {
        printf("%d",i++);
    }while(5,4,3,2,1,0);  //what does this do ?

    return 0;
}

**O/P=40**

我无法弄清楚以上代码中的while循环是做什么的.....

我知道while循环至少执行一次。由于while循环的O/P=40条件评估为false,但是我无法弄清楚怎么办?

表达的结果

5,4,3,2,1,0

0 所以do - while执行恰好一次。

请参见逗号运算符

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM