大神们这个运行正确,输出错误什么情况,哪里的问题求解
{
char c = 'a';
int n = c ; //将c赋值给n
float f = n ; //将c赋值给f
double d = f ; //将c赋值给d
printf("%d\n",n);
printf("%f\n",f);
printf("%1f\n",d);
return 0;
}
{
char c = 'a';
int n = c ; //将c赋值给n
float f = n ; //将c赋值给f
double d = f ; //将c赋值给d
printf("%d\n",n);
printf("%f\n",f);
printf("%1f\n",d);
return 0;
}
2019-01-07
amesy@amesy-vm:/c/basic_2$ cat main.c #include <stdio.h> int main() { char c = 'a'; int n = c ; //将c赋值给n float f = n ; //将c赋值给f double d = f ; //将c赋值给d printf("%d\n",n); printf("%f\n",f); printf("%f\n",d); return 0; }amesy@amesy-vm:/c/basic_2$ amesy@amesy-vm:/c/basic_2$ gcc main.c amesy@amesy-vm:/c/basic_2$ ./a.out 97 97.000000 97.000000 amesy@amesy-vm:/c/basic_2$
你的错误在于第十行, 仔细对照下就清楚了.
我新建了一个QQ群(538136490),你可以加进来我们一起讨论学习!
举报