I am making a simple game, which needs me to create a board of size defined by the user.
I have been writing a function that is supposed to return the board (matrix) that I will be using for my game, but I can't seem to get it to work.
I tried using the nested for loop method to print out the matrix in the main function, but I have troubles implementing it and returning it from a function.
int* boardStateDead(int width, int height){
int* board_dead_state[width][height];
for(int i = 0; i < height; i++){
for(int j = 0; j < width; j++){
board_dead_state[i][j] = 0;
}
}
return board_dead_state;
}
I expect the function to be able to return a pointer to the matrix that I just made.