c语言变量莫名其妙被改变
#include<stdio.h>
#include<math.h>
int AADT=1992;
/*AADT*/
double avaxle=2.54;
/*axle number per truck*/
double lane=0.5;
/*lane coefficient*/
double direction=0.7;
/*direction coefficient*/
double PSIGLE=57.1;
double PTRADEM=34.5;
double PTRIDEM=8.4;
/*Traffic composition*/
double distribution[100];
int section;
void main()
{
int i,j,k,l,month,day,hour;
double temperature=0.0;
/* for read the everyday temperature*/
double yeartraffic; /* total year traffic*/
double ptemperature;
double ns,nr;
double h; /* pavement thickness*/
double z; /* half pavement thickness*/
double modulus,strain;
double c=0.435373; /* fatigue function*/
double d,damage; /*cumulative damage*/
double n,nn; /* Miner hypothisis*/
double monthadjust[12]; /*for read the month traffic adjust coefficient*/
double houradjust[24];
/*for read the day traffic adjust coefficient */
double singleweight[50],singlepercent[50];
double trademweight[50],tradempercent[50];
double tridemweight[50],tridempercent[50];
int days; /*month days*/
int SN=0,TAN=0,TIN=0;
FILE *ft;
FILE *fp;
FILE *fs;
FILE *fr;
printf("Please input pavement structure number(1,2,3,4,5):\n");
scanf("%d",§ion);
if(section==1) h=50;
if(section==2) h=38;
if(section==3) h=38;
if(section==4) h=33;
if(section==5) h=15;
z=h/2;
yeartraffic=AADT*avaxle*365*lane*direction; /*year total traffic*/
fs=fopen("month.txt","r");
if(fs==NULL)printf("file open error!\n");
while(!feof(fs))
{fscanf(fs,"%d %lf\n",&i,&ns);
monthadjust[i]=ns;
printf("month=%d,coefficient=%f\n",i,monthadjust[i]);
}
fclose(fs);
system("pause"); /* to read the month traffic adjust coefficient*/
printf("month=%f\n",monthadjust[12]);system("pause");
fs=fopen("hour.txt","r");
if(fs==NULL) printf("file open errors!\n");
while(!feof(fs))
{fscanf(fs,"%d %lf\n",&i,&ns);
houradjust[i]=ns;
printf("hour=%d,coefficient=%f\n",i,houradjust[i]);
}
fclose(fs);
system("pause"); /*to read the day traffic adjust coefficient*/
printf("month=%f\n",monthadjust[12]);system("pause");
for(i=1;i<=12;i++)
printf("%f\n",monthadjust[i]);
}
monthadjust[i]变量当i=12时被没名奇妙的变为houradjust[i]一样的数是怎么回事?
c中的变量还会冲突或自动改变吗?