The difference between '\0' and '0'?

aka2006 2003-10-23 08:29:19
The difference between '\0' and '0'?
...全文
62 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
mprogrammer 2003-10-23
  • 打赏
  • 举报
回复
'\0'是c语言中字符数组的结束标志,ASCII值为0;
‘0’代表字符0,ASCII值位30H, 48D。
双杯献酒 2003-10-23
  • 打赏
  • 举报
回复
'0' == 0x30 == 48
'\0' == 0x00 == 0
Hot_Forever 2003-10-23
  • 打赏
  • 举报
回复
the value of '\0' =0,means the end of a string
the value of '0'=48, just means a char
you may test by follows:

#include <stdio.h>
#include <conio.h>

int main()
{
char c='\0';
printf("%d\n",c);
c='0';
printf("%d\n",c);
getch();
return 0;
}
xdspower 2003-10-23
  • 打赏
  • 举报
回复
'\0'一般是定义为字符串结束符号,是不能显示的,最为整数时是值为0,'0'就是字符 '0',它显示时显示为一个字符'0' 它的字符编码不为0,故作为整数使用时不为0。
kuaibao 2003-10-23
  • 打赏
  • 举报
回复
i have nothing to say ~ find up in you books~

69,369

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧