if(--n == n) [英] if (--n==n)

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

问题描述

大家好,


我有一小段代码...

main()

{

int n = 10;


if( - n == n)

{

printf( " \ n Pre");

}

if(n - == n)

{

printf(" Post");

}


} // main

什么是输出上面的代码。


谢谢

Raman Chalotra

Hi All,

I have small fragment of code ...
main()
{
int n=10;

if(--n==n)
{
printf("\n Pre");
}
if(n--==n)
{
printf(" Post");
}

}//main
What shall be the output of the above code.

Thanks
Raman Chalotra

推荐答案

Raman< ra *********** @ gmail.comwrote:
Raman <ra***********@gmail.comwrote:

大家好,


我有一小段代码...

main()

{

int n = 10;


if( - n == n)

{

printf(" \\\
Pre");

}


if(n - == n)

{

printf(" Post");

}


} // main


上述代码的输出是什么。
Hi All,

I have small fragment of code ...
main()
{
int n=10;

if(--n==n)
{
printf("\n Pre");
}
if(n--==n)
{
printf(" Post");
}

}//main
What shall be the output of the above code.



未定义的行为,请参阅c.l.c的第3节。常见问题:

http://docs.mandragor.org/files/Prog.../C-faq/s3.html


Raman写道:
Raman wrote:

大家好,


我有一小段代码...

main()

{

int n = 10;


if( - n == n)

{

printf(" \ n Pre");

}


if(n - == n)

{

printf(" Post");

}


} // main


上述代码的输出结果如何。
Hi All,

I have small fragment of code ...
main()
{
int n=10;

if(--n==n)
{
printf("\n Pre");
}
if(n--==n)
{
printf(" Post");
}

}//main
What shall be the output of the above code.



它会点燃你的电脑。


你在几个地方调用未定义的行为。请参阅以下链接:

< http://c-faq.com/expr/index.html>

It''ll set fire to your computer.

You''re invoking undefined behaviour in several places. See link below:
<http://c-faq.com/expr/index.html>


santosh说:
santosh said:

Raman写道:
Raman wrote:

>>
什么是输出上面的代码。
>>
What shall be the output of the above code.



它会点燃你的电脑。


It''ll set fire to your computer.



标准实际上并不保证这一点。


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上述域名中, - www。

The Standard does not actually guarantee this.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.


这篇关于if(--n == n)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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