I'm getting this error on line #4 which says 'invalid initializer'. I know what the error means, but I can't work out why i'm getting the error. I've tried all sorts of combinations of pointers and values, but it doesn't seem to want to work. Any help / feedback for the code would be greatly appreciated.
Note: I plan to have a 2D array for the chessboard, which mean 64 ints of memory malloc'd. The printf is there to keep the compiler happy and show me whether at [4][2] there is a '0'.
int *newBoard();
int main(int argc, char *argv[]) {
int *chessBoard[7][7] = *newBoard();
printf ("%d", chessBoard[4][2]);
return EXIT_SUCCESS;
}
int *newBoard() {
int counter = 0;
int *blankBoard = malloc(sizeof((int) * TOTALSPACES));
while (counter < TOTALSPACES) {
blankBoard[counter] = VACANT;
counter++;
}
return blankBoard;
}