解释这..... [英] explain this.....

查看:72
本文介绍了解释这.....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个下面的代码片段:

for(; 0;)


printf(" Gud Morning");


当这个运行时,我得到了gud morning。打印消息,尽管for循环中的
条件设置为false(0)。


请解释一下或给我一个语义概念''for''

声明......

解决方案

muttaa写道:< blockquote class =post_quotes>我有一个下面的代码片段:

for(; 0;)

printf(" Gud Morning");

当这个运行时,我会得到gud morning。打印消息,尽管for循环中的
条件设置为false(0)。

请解释一下或者让我知道''for''的语义/>声明......




将来,请尝试提供最小的_compilable_源代码

来展示问题。上面的代码不完整。在任何情况下,

printf()语句都不会执行。


muttaa写道:

我有一个下面的代码片段:

for(; 0;)

printf(Gud Morning);

当这个时候跑了,我得到了gud morning。打印消息,尽管for循环中的
条件设置为false(0)。



不适合我。表达式_should_评估为false(实际上,

非零)。


" void * clvrmnky()" ; < CL ************** @ hotmail.com.invalid>写道:

muttaa写道:

我有一个下面的代码片段:
for(; 0;)
printf(" Gud Morning" ;);
当这个运行时,我得到了gud morning。打印消息,尽管
for循环中的条件设置为false(0)。


不适合我。表达式_should_评估为false(好吧,实际上,非零)。




非零为真;零是假的。


-

Keith Thompson(The_Other_Keith) ks * **@mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。


i''ve a code snippet below:
for(;0;)

printf("Gud Morning");

when this is run,i get the "gud morning" message printed,eventhough the
condition in the for loop is set to false(0).

Please explain this out or give me an idea of the semantics of ''for''
statement......

解决方案

muttaa wrote:

i''ve a code snippet below:
for(;0;)

printf("Gud Morning");

when this is run,i get the "gud morning" message printed,eventhough the
condition in the for loop is set to false(0).

Please explain this out or give me an idea of the semantics of ''for''
statement......



In future, please try to provide the smallest _compilable_ source code
exhibiting the problem. The above code is not complete. In any case the
printf() statement will not execute.


muttaa wrote:

i''ve a code snippet below:
for(;0;)

printf("Gud Morning");

when this is run,i get the "gud morning" message printed,eventhough the
condition in the for loop is set to false(0).


Not for me. That expression _should_ evaluate to false (well, actually,
"non-zero").


"void * clvrmnky()" <cl**************@hotmail.com.invalid> writes:

muttaa wrote:

i''ve a code snippet below:
for(;0;)
printf("Gud Morning");
when this is run,i get the "gud morning" message printed,eventhough
the
condition in the for loop is set to false(0).


Not for me. That expression _should_ evaluate to false (well,
actually, "non-zero").



Non-zero is true; zero is false.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


这篇关于解释这.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆