Crashes the compiler? You mean it gives you a compiler error? In that case it would be very helpful if you posted it.
If it crashes at runtime I would suspect row and col to be set incorrectly. Make sure they have the same value as the dimensions of the game board.
If mines start out below zero the loop will never run.
If mines start out above zero the loop will never stop.
Are you sure you want to increment mines inside the loop?
set as const ints, same issue, can get into the main menu, freezes on selecting it, if I take out the Random function though, it works fine, so obviously there's something wrong there
In my last post, I was suggesting that row and col were constint and that you were trying to change them in your code, which is illegal. Sorry if I wasn't clear.
Anyway, from the fact that they are not declared in your function, they must be global variables. Are they used in loop conditions when you populate your array?
If so, they really should be constint and this part
1 2 3 4 5
row=rand()%8;
col=rand()%8;
if (minesweeper[row][col] !=mine)
{
minesweeper[row][col]=mine;
should be changed to
1 2 3 4 5
int r=rand()%row;
int c=rand()%col;
if (minesweeper[r][c] !=mine)
{
minesweeper[r][c]=mine;
Your code is messed up. It looks like mine_set() is being defined inside initialise() because there is no ending }, and lines 183-189? Copy paste error?
yea, I musta missed that part when I copied it, its there in the original code
183-189 is part of my main menu, thats the part that starts the game, I left the rest out as it's not relevant, but wanted to include that part as it starts after selecting option 1
On line 41/42 you use the global variables form line 22. But since they permanently change (like on line 93/95, 61/65) you cannot predict what the value is.