printf 输出值与变量值不同为什么
程序代码:
#include<stdio.h> #include<math.h> double lagechazhi(double *a,double *b,double x,int n) { int i,j; double sum,SUM=0; for(i=0;i<n;i++) { sum=1; for(j=0;j<n;j++) { if(j!=i) sum=sum*(x-a[j])/(a[i]-a[j]); } SUM=SUM+sum*b[i]; } printf(" SUM=%d\n",SUM);//...............在此处设置断点显示的只是3.053多但是经printf输出为-183144; return SUM; } void main() { double a[3]={1,1.05,1.07},b[3]={2.71828,3.28630,3.52761}; lagechazhi(a,b,1.03,3); }