是'\0'== 0 [英] is '\0' == 0

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

问题描述



''\'''将所有位设置为零。


所有位零是否等于整数'0?


-

?[1; 30m |?[m

?[32m ___?[m

?[32m(-_-)?[m

?[32m< ????>?[1; 30m¢w¢w¢w¢w¢ w w w w w w w w w w [[;;;;;;? ?[0; 37mshepjeng.twbbs.org?[1; 30m¢w¢w / w
?[1; 30m?t?[m?[36mplum.cs.nccu.edu.tw? [m


''\0'' is all bits set to zero.

Is all bits zero equal to integer''s zero?

--
|
 ___
(-_-)
<????>¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w¢w a?′?aa3? shepjeng.twbbs.org ¢w¢w¢w
?t plum.cs.nccu.edu.tw

推荐答案



" I wish" < GA ************ @ shepjeng.twbbs.org>在消息中写道

news:48 ******** @ shepjeng.twbbs.org ...

"I wish" <GA************@shepjeng.twbbs.org> wrote in message
news:48********@shepjeng.twbbs.org...

''\'''将所有位设置为零。

所有位零都等于整数'0'?

''\0'' is all bits set to zero.

Is all bits zero equal to integer''s zero?




''\'''实际上等于0.请注意,字符文字实际上是
的类型是int(如果它们是
可以适合int类型,那么整数数字文字也是如此)。


如果在字符串或字符文字中有一个完整的

数字前面的转义字符,则该数字将是

用作它支持。


请记住,char只是一个完整的类型,因为短而长

是。


我没有交流编译器,所以你可能需要修复下面的一些

语法错误。


#include< stdio.h>


int main(无效)

{

char a,b;


a =''\ 0'';

b = 0;

if(a == b)

puts(a和b在这里相等);


a =''\ 1'';

b = 1;

if(a == b)

puts(" Looks像a和b在这里相等。);


返回0;

}



''\0'' is in fact equal to 0. Note that character literals actually
have type int (and so does integral numeric literals if they
can fit in type int).

When you have the escape character in front of an integral
number in string or character literal then that number will be
used as it stands.

Remember that a char is just a integral type as short and long
are.

I don''t have a c compiler handy so you might need to fix some
syntax errors in the below.

#include <stdio.h>

int main(void)
{
char a, b;

a = ''\0'';
b = 0;
if(a == b)
puts("a and b are equal here");

a = ''\1'';
b = 1;
if(a == b)
puts("Looks like a and b are equal here.");

return 0;
}


Thomas Stegen< ts ***** @ cis.strath.ac.uk>这样说:
Thomas Stegen <ts*****@cis.strath.ac.uk> spoke thus:
''\'''实际上等于0。
''\0'' is in fact equal to 0.




只是为了迂腐,这是否意味着实施

必须以同样的方式表示''\0''和0?


-

Christopher Benson-Manica | Jumonji giri,荣誉。

ataru(at)cyberspace.org |



Just for the sake of pedanticness, does this imply that the implementation
must represent ''\0'' and 0 in the same way?

--
Christopher Benson-Manica | Jumonji giri, for honour.
ataru(at)cyberspace.org |


Christopher Benson-Manica写道:
Christopher Benson-Manica wrote:

Thomas Stegen< ts ***** @ cis.strath.ac.uk>这样说:

Thomas Stegen <ts*****@cis.strath.ac.uk> spoke thus:
''\'''实际上等于0。
''\0'' is in fact equal to 0.



只是为了迂腐,这是不是意味着实施
必须以同样的方式代表''\0''和0?



Just for the sake of pedanticness, does this imply that the implementation
must represent ''\0'' and 0 in the same way?




只是为了迂腐,它''无法分辨:

您无法检查数字文字的表示形式。

您可以将文字的值存储到数据对象中并且

检查那个*,但是关于文字本身如何表示的结论是多么不安全




例如,考虑具有零存储机器指令的机器。 C代码`int x = 0;''可能

生成像'stz x'这样的东西 - 文字会

有*没有*代表性的形象!


-
Er ******* **@sun.com


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

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