代码显示问题
各位同学前辈,我这个代码运行显示正确,但是显示的都是乱码是怎么回事?
#include
int main()
{
char c = 97;
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;
}
显示结果:
/249/5117/8r7b/hello.c: In function 'main':
/249/5117/8r7b/hello.c:6:5: error: expected ',' or ';' before 'float'
float f = c //将c赋值给f
^
/249/5117/8r7b/hello.c:9:19: error: 'f' undeclared (first use in this function)
printf("%f\n",f);
^
/249/5117/8r7b/hello.c:9:19: note: each undeclared identifier is reported only once for each function it appears in
/249/5117/8r7b/hello.c:10:20: error: 'd' undeclared (first use in this function)
printf("%lf\n",d);