Hello everyone!

So I am still coding this game and every time I make progress
somewhere I take a step back somewhere else.
I know that it is late but I am re-writing from scratch. Anyway, the
basic concept of how I am doing this now is as follows:

I have two main objects: a Square object, which is used to represent a
square on a checker board, and a Board object, which contains some
functions and more importantly, an 8 by 8 array of pointers to
Squares.

Anyhow, I have two functions, ResetBoard and Print Board, both of
which accept a pointer to an array as an argument. Here are the
function Prototypes.

(These are both member functions from Board)

From Board.cpp

void Board::PrintBoard( Square* Board[][8] )
void Board::ResetBoard ( Square* Board[][8] )

From Board.h

void PrintBoard ( Square* squarePosition[][8] );
void ResetBoard ( Square* squarePosition[][8] );

From Main, I am trying to call them like this:

Board newBoard;

newBoard.ResetBoard(&newBoard.squarePosition[][8]);
newBoard.PrintBoard(&newBoard.squarePosition[][8]);

When I compile, I get the following error for both lines in main:

main.cpp:23: error: expected primary-expression before ']' token
main.cpp:24: error: expected primary-expression before ']' token

Does anybody know what I am doing wrong? I assume it is the way that I
am trying to pass them. Any help??
A timely response would be very much appreciated.

Thank you.
~Chris Giarla

Take the [][8] of your calls. When you are passing a whole array, you only use the array name, you don't use any index(es).

Edited 6 Years Ago by Fbody: n/a

This article has been dead for over six months. Start a new discussion instead.