c++ - Unknown Segmentation fault -


i getting segmentation fault when running following code:

const int sensors = 65; static float coefficient[sensors][6]; const int numsubsystem = 6; const int allsensors = sensors * numsubsystem; using namespace std;  int row = 0; static int outputerror = -1; //static retain value  ifstream equationfile("equation.txt");  static string sensornameequation[allsensors]; static float coefficientoverride[allsensors][6]; //static keep large array off stack static string dependantsensor[allsensors]; //static keep large array off stack static float basetemp[allsensors]; //static keep large array off stack  printf("total sensors: %d\n", allsensors);  row = 0; if(equationfile) {     while( equationfile >>          sensornameequation[row] >>          coefficientoverride[row][0] >> coefficientoverride[row][1] >>          coefficientoverride[row][2] >> coefficientoverride[row][3] >>          coefficient[row][4] >> oefficient[row][5] >>          dependantsensor[row] >> basetemp[row])     {         row++;         printf("sensors: %d\n", row);     }      equationfile.close();//done reading file...close } 

it gets line 102 of equation file seg faults. ideas why be?

looks you're going out bounds of coefficient array, looks should declared others static float coefficient[allsensors][6];


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -