'\ 0'和0之间的区别 [英] Difference between '\0' and 0

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

问题描述

大家好,


如果c是char,那么


c =''\ 0''之间是否存在差异br />




c = 0



问候,

八月

Hello all,

If c is a char then is there any difference between

c = ''\0''

and

c = 0

?
Regards,
August

推荐答案

August Karlstrom写道:
August Karlstrom wrote:

大家好,

如果c是一个字符,那么

之前是否存在差异?=''\ 0''


c = 0


Hello all,

If c is a char then is there any difference between

c = ''\0''

and

c = 0

?




无论c是什么。

'' \\ 0''和0都是常量主表达式

类型为int且值为零。


-

pete



It doesn''t matter what c is.
''\0'' and 0 are both constant primary expressions
of type int and value zero.

--
pete





August Karlstrom写道:


August Karlstrom wrote:
大家好,

如果c是一个字符然后是否有任何区别

c =''\ 0''



c = 0


问候,
8月
Hello all,

If c is a char then is there any difference between

c = ''\0''

and

c = 0

?
Regards,
August



呃,实际上,在C中,char是一个8位整数(不是所有)。

''\ 0''的ASCII值是0.So c =''\ 0''等于c = 0.在许多程序中,我们使用char代替<当整数很小时,
of int。


Er,in fact,in C, a char is an 8-bit integer(not all).The ASCII value of
''\0'' is 0.So c=''\0'' equals to c=0 .In many programs,we use char instead
of int when the integer is small.


pete写道:
August Karlstrom写道:
August Karlstrom wrote:
大家好,

如果c是char,那么

c =''\'''之间是否有任何区别


c = 0

Hello all,

If c is a char then is there any difference between

c = ''\0''

and

c = 0

?



无论c是什么。
''\ 0''和0都是int类型和值零的常量主表达式。


It doesn''t matter what c is.
''\0'' and 0 are both constant primary expressions
of type int and value zero.




Lint程序Splint认为存在差异:



The Lint program Splint thinks there is a difference:


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

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