终于明白了。我将程序又增加内容后:其原因是跟char类型有关,这个定义只认单字面量,而65不是单字面量,就向7楼的大虾说得那样,char只能读出低位的值。
#include <stdio.h>
#include <stdlib.h>
int main()
{
char
a=65;
char
aa='65';
char
aaa='\065';
char
aaaa='\x65';
char
aaaaa='\65';
char
aaaaaa='4';
printf("a is %c not %d,\n",a,a);
printf("aa is %c not %d,\n",aa,aa);
printf("aaa is %c not %d,\n",aaa,aaa);
printf("aaaa is %c not %d,\n",aaaa,aaaa);
printf("aaaaa is %c not %d,\n",aaaaa,aaaaa);
printf("aaaaaa is %c not %d,\n",aaaaaa,aaaaaa);
return 0;
}
运行结果如下
图片附件: 游客没有浏览图片的权限,请
登录 或
注册