I am trying to return a two-dimensional array from a function, but something goes wrong. arr2 on the main function is getting an error,
CXX0030: Error: expression cannot be evaluated
Code
int** file2array(char* filename) {
FILE *fp = NULL;
char c;
int i = 0;
int arr[9][9];
if ((fp = fopen(filename, "r")) == NULL)
{
printf("File could not be opened\n");
}
else
{
while (!feof(fp))
{
c = fgetc(fp);
if (c == '.') {
arr[i/9][i%9] = 0;
i++;
}
if (c>= '1' && c<='9') {
arr[i/9][i%9] = c - 48;
i++;
}
}
fclose (fp);
}
return arr;
}
int main(){
int** arr2 = file2array("SolverInput.txt");
}