double型的问题,为什么结果是这样的?
#include "stdio.h"void main()
{
double x=0.0;
double y;
scanf("%f",&x);
y=x;
printf("%1.4f",&x);
getch();
}
程序如上面。比如输入“1”,结果却是“0.0000”。
我怎么想不明白
2007-09-25 01:33

看红色部分.
&关键是这个,刚才你把地址输出来了

2007-09-25 01:54
2007-09-25 02:41
2007-09-25 08:38
2007-09-25 09:11
#include "stdio.h"
void main()
{
double x=0.0;
double y;
scanf("%lf",&x);//%lf
y=x;
printf("%1.4lf",&x);//double是%lf
getch();
}

2007-09-25 11:15
[此贴子已经被作者于2007-9-25 17:41:09编辑过]

2007-09-25 17:36
2007-09-25 17:44