等待故事里的那个人
2017-01-03 11:05
#include
int main() { char c = 'a'; int n = c ; //将c赋值给n float f = c; //将c赋值给f double d = c; //将c赋值给d printf("%d\n",n); printf("%f\n",f); printf("%lf\n",d); return 0; } 为什么不能int n = 'c' ; float f = 'c'; double d = ' c';#include <stdio.h>
int main()
{
char c = 'a';
int n = 97 ; //将c赋值给n
float f = 97.000000 ; //将c赋值给f
double d = 97.000000 ; //将c赋值给d
n=c;
f=c;
d=c;
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
}
#include <stdio.h>
int main()
{
char c = 'a';
int n =c=97; //将c赋值给n
float f =c=97.000000; //将c赋值给f
double d =c=97.000000; //将c赋值给d
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
int是整型,不能存储字符
C语言入门
926020 学习 · 20793 问题
相似问题