I am trying to load data from a file into an array and am getting a segmentation error, I am not quite sure where my issue is. Any help is appreciated.
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
FILE* GetFile();
int GradeAvgs();
int GradeSort();
int PrintOut();
int main(void) {
FILE* userFile = GetFile();
double* studentGrades[6][10];
int i = 0;
int j = 0;
for(i = 0; i < 5; i++){
for(j = 0; i <= 9; j++){
while(!feof(userFile)){
fscanf(userFile, "%lf", studentGrades[i][j]);
}
}
}
return 0;
}
FILE* GetFile(){
FILE* fiStrm;
char fileName[40];
printf("Please enter the name of your file: \n");
fgets(fileName, 40, stdin);
fileName[strlen(fileName) - 1] = '\0';
fiStrm = fopen(fileName, "r");
perror("Error: \n");
if(fiStrm == NULL){
printf("No such file or Failure to open file.\n");}
return fiStrm;
}