Hey folks, back again in search of more help.

I've been programming a relatively simple game that builds a 6 X 6 grid, then takes six numbers submitted by the player and eliminates the row and column of numbers that the number is in - so that the player can't choose any of those numbers or the one they selected again.

Now on to the problem; in the function that eliminates the number, row and column I have a little bit of programming that checks to make sure the number isn't under 0 or above 36 and that it isn't one of the numbers already eliminated. When the program loads up; it accepts any number that's been eliminated which is because I told the program to check that it wasn't a 0, which is what the eliminated numbers are turned into...but that isn't what the player is actually submitting so of course the number is accepted even if the number's already been eliminated - I'm not sure how to code it to keep track of the numbers that either are or are not valid. Any help on that would be appreciated.

The other problem is if you submit a number over 36 the program will catch that and ask you to submit a new number, but then it crashes with the Microsoft window coming up and asking to submit the hairy details to them, yadda yadda yadda.

Here's the function that is causing the problem, and I've attached the full program in a txt in case something needs to be changed there.

Code:/* This function eliminates the rows and columns of numbers based on what the player has selected */ int elim( int gr[][6], size_t size, int subNum ){ int row, col, r, c; /* This is making sure that the number submitted is a valid number */ while(subNum <= 0 || subNum > 36){ printf( "That is not a valid number, please choose a number that is on the grid (other than zero)\n"); scanf( "%2d", subNum ); } for(r = 0; r < GRID_ROWS; r++) { for(c = 0; c < GRID_COLUMNS; c++) { if( gr[r][c] == subNum ) { /* to adjust an entire row in a 2D array */ row = r; for(col = 0; col < GRID_COLUMNS; col++) gr[row][col] = 0; col = c; for(row = 0; row < GRID_ROWS; row++) gr[row][col] = 0; } } } return subNum; }