I'm try to make a program that import a grid from a data file and does something with it, but I'm running into problems when trying to import the grid into a multidimensional array.
I'm getting an "Unhandled Exception" error with the if-else statement inside my while loop. When I comment out this part of my code it runs perfectly.
int main( void ) {
FILE* grid = fopen( FILE_NAME, "r" );
int row = 0;
int column = 0;
int intGrid[21][21];
// Null check omitted for space.
while( fscanf( grid, "%d ", &intGrid[row][column] ) == 1 ) { // Loads the grid into an array
if( intGrid[row][column] != -1 )
column++;
else
column = 0;
row++;
}
Can anyone please spot the problem in my code.