簡體   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