I'm developing a simple minesweeper using 2d arrays in c++. However I am stuck at
a point where the program seems to count the mines correctly for the most part except the boundaries (mainly first and last columns. I'll really appreciate if you keep it simple because i'm just a beginner and dont want to make thing complex for myself.
How you do it is up to you but if you want minimum changes to your code you could just add a check inside each if statement, like this:
1 2 3 4
...
if (X > 0 && c[X-1][Y] == 9)
mines++;
...
Note that the check should be before accessing the array element to avoid out-of-bounds access.
Talking about out-of-bounds, why are you returning (*c)[10] from the function? *c is the same as c[0], so you are accessing c[0][10] which seems to be out of bounds.