I'm following along a book on teaching yourself C++, and there's a question about creating the layout of a chess board using enums and arrays. Looking at their solution, they call an enum to declare the potential state of any given square on the board. BUt I don't fully understand what's going on after that. Their code looks like this:
int main()
{
enum Square
{
Empty = 0,
Pawn,
Rook,
Knight,
Bishop,
King,
Queen
};
Square chessBoard[8][8];
chessBoard[0][0] = chessBoard[0][7] = Rook;
//Follow this pattern to initialise the rest of the pieces
return 0;
}
I don't understand what "Square chessBoard" is actually doing in this case. I'm a complete beginner in this, so any help is hugely appreciated.