EDIT: found a solution probrably
I want to set 2d array a 2d return but it keeps giving me nonsense errors:
In function 'int main()':
error: expected primary-expression before ']' token
error: expected primary-expression before ']' token
In function 'int initBoard(int (*)[25])':
error: invalid conversion from 'int (*)[25]' to 'int' [-fpermissive]
I can't just figure out what is wrong and how to make error go away.
#include <iostream>
using namespace std;
const short WIDTH = 80;
const short HEIGHT = 25;
int clearBoard();
int initBoard(int board[WIDTH][HEIGHT]);
int drawBoard();
int main()
{
int board[WIDTH][HEIGHT] = {{0}};
board = initBoard(board); // problem is this place AND should be initBoard(board);
cout << board[79][24]
return 0;
}
int initBoard(int board[WIDTH][HEIGHT])
{
unsigned int localWidth = 1;
unsigned int localHeight = 1;
while(localHeight < HEIGHT)
{
while(localWidth < WIDTH)
{
board[localWidth][localHeight] = 0;
localWidth++;
}
localHeight++;
localWidth = 1;
}
}