#include <stdio.h> int main() { char c = 'a'; int n ='a'; //将c赋值给n float f ='a'; //将c赋值给f double d ='a'; //将c赋值给d 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; //将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;
}
字符‘a’赋值给c了已经,你只要按照题意来赋值;n=c;f=n;d=f;题是死板的,程序是灵活的。