So, new problem now that I've fixed the if-statement issue. My recursion function is filling up the whole grid with a single number instead of just a few squares leading up to the mines. This is really making no sense...
My apologies, but I'm afraid I can't post my actual code because of stipulations with the project. Basically, it's supposed to work like this.
The minesweeper is made of a 2D array of structs.
So, in the recursion, it's supposed to set a variable inside the struct to be true so that they are revealed. Then it's supposed to reveal consecutive squares around the coordinates of the square entered, without revealing the mines themselves unless the coordinate was a mine.
In pseudocode, I'm guessing it would look like:
void function
{
structure[n][m] is revealed;
if structure[n][m] is a mine, return
if not,
function (n+1, m-1);
etc...
}
I've been reading several topics on this, but all of the solutions use a combination of int and char grids instead of this struct array I'm supposed to use.
All I'm asking for is some tips on doing recursion on a 2D struct array, because this method is not producing any good results.
Recursion using a 2D struct is really no different than using an int or char array.
You pass the struct array in the recursive call just as you would an int or char array.
*facepalm* Ok, so it turns out it wasn't my recursive function that was messed up. My file-checking was being done wrong. So, sorry to change the question, but if I'm passing a text file to a program via command line argument, how can I make sure argv is a certain file?