Hi, my program compiles but when i run it, i get segmentation fault ? can anybody help > thanks in advance.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
float winddata[6572][15];
int undays = 0;
FILE *wind_data;
wind_data = fopen("wind_data.txt","r");
if(wind_data == NULL){
printf("Error: can't open file.\n");
return(1);
}
else{
int i;
int j;
while(!feof(wind_data))
{
for(i = 0; i <6573; i++){
for(j = 0; j <15; j++)
{
fscanf(wind_data, "%f", &(winddata[i][j]));
}
}
}
for(i =0; i<6573; i++){
if(winddata[i][3] < 5.828){
undays++;
}
}
fclose(wind_data);
printf("Unproductive days %d\n", undays);
return(0);
}
when i run it, the program displays the Unproductive days, but on a next line i get
"Segmentation fault.