The problem I'm having with my code is located at
As you can see, there doesn't seem to be any trouble; I'm mostly just outputting some data to a file. The problem I'm having is (output; not code):Code:void fGR(double x[NSTEPS], double y[NSTEPS], double sig[NSTEPS], double **GRalpha, double **GRbeta, int ma, double chi, int nu, double Q, double GRa[GRma]) * * * fout1 << "GRma:" << ma << " GR[]:" << GRa[0] << " " << GRa[1] << endl; fout1 << "FF L50: GRalpha[][0]\tGRalpha[][1]\tGRbeta[][0]" << endl; for(i=1; i<=ma; i++) { fout1 << endl << "54GR:" << GRa[0] << " " << GRa[1] << endl; fout1 << "[" << i << "][] \t "; for(j=1; j<=ma; j++) { GRalpha[i][j] = 0.0; fout1 << GRalpha[i][j] << "\t\t"; } fout1 << endl << "61GR:" << GRa[0] << " " << GRa[1] << endl; GRbeta[i][0] = 0.0; fout1 << GRbeta[i][0] << endl; }
I input into the function GRa[0] = 430.819, GRa[1] = 6.0904. After the second iteration of the outer for loop, it suddenly changes GRa[0] to 0 for no apparent reason. Why would a program suddenly do this?Code:GRma:2 GR[]:430.819 6.0904 FF L50: GRalpha[][0] GRalpha[][1] GRbeta[][0] 54GR:430.819 6.0904 [1][] 0 0 61GR:430.819 6.0904 0 54GR:430.819 6.0904 [2][] 0 0 61GR:0 6.0904 0



LinkBack URL
About LinkBacks



. It'd also help if you cleaned the code up a bit, including indenting, avoid writing 'endl' until the end of lines (not at the start).