关于for循环中的变量值
#include<stdio.h>#define A 1.0
#define B -1.0
#define C 2
double f(double a,double b,double c,double x);
int main()
{
double x;
for(x=0.0;x<=3.0;x+=0.1)
{
printf("x=%lf ",x);
printf("value=%lf\n",f(A,B,C,x));
}
return 0;
}
double f(double a,double b,double c,double x)
{
double value;
value=(a*x+b)*x+c;
return value;
}
/*#include<stdio.h>
int main(void)
{
int i;
for(i=0;i<=30;i++)
printf("%d\n",i);
return 0;
}*/
为什么编译第一个程序时输出的x为0.0~2.9,而第二个程序输出的i却是0~30的呢?