[英]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**
I am unable to figure out what the while loop does in the above code..... 我无法弄清楚以上代码中的while循环是做什么的.....
I know that do while loop execute atleast once.As the O/P=40
condition of while loop evaluates to false but iam unable to figure out how? 我知道while循环至少执行一次。由于while循环的
O/P=40
条件评估为false,但是我无法弄清楚怎么办?
The result of expression 表达的结果
5,4,3,2,1,0
is 0
. 是
0
。 So do
- while
is executed exactly one time. 所以
do
- while
执行恰好一次。
See Comma operator . 请参见逗号运算符 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.