char c='a';
int n='c';
float f='c';
double d='c';
printf("%d\n",n);
printf("%f\n",n);
printf("%lf\n",n);
char c='a';
int n='c';/*这里你用了单引号,相当于你把字符c储存进了n变量,因为c的ASCII码是99(a是97),
因为int是整型,自动把字符c对应的ASCII值99存进去了,所以得到结果为99,下面也是这样,
去掉单引号即可*/
float f='c';//去掉单引号即可
double d='c';//去掉单引号即可
printf("%d\n",n);
printf("%f\n",n);
printf("%lf\n",n);'c'的ASCII码就是99 你应该把c的单引号都去掉
这样写
char c='a';
int n=c;
float f=c;
double d=c;
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);