Why would I get a Segmentation Fault error? It compiles fine with g++, but gives an error when it runs.
void blowUp(char *board, int *boardSkin, int row, int column)
{
//set the board's 'skin' to 1, (meaning it will be displayed)
*(boardSkin +(row * columns) + column) = 1;
//with code after this removed, error is gone
//if the board space was empty, recursively call function to
//all surrounding cells
if(*(board +(row * columns) + column) == ' ')
{
//blow up surrounding cells
//upper left
blowUp(board, boardSkin, row-1, column-1);
//up
blowUp(board, boardSkin, row-1, column);
//upper right
blowUp(board, boardSkin, row-1, column+1);
//right
blowUp(board, boardSkin, row, column+1);
//lower right
blowUp(board, boardSkin, row+1, column+1);
//down
blowUp(board, boardSkin, row+1, column);
//lower left
blowUp(board, boardSkin, row+1, column-1);
//left
blowUp(board, boardSkin, row, column-1);
}
}