I want to be able to use pointers to manipulate a struct I have defined as opposed to returning a struct object from the method. While I am not horribly concerned about optimization at this stage, I used to know how to this this.
Constants and typedef code, from header file:
Code:
#define FIARROWS 6
#define FIARCOLUMNS 7
typedef enum {PLAYER1, PLAYER2, PLAYER3, PLAYER4, EMPTY} player;
typedef struct
{
int COLUMNS;
int ROWS;
int locations[FIARCOLUMNS][FIARROWS];
} FIARBoard;
I understand the struct may seem unnecessary at this point, but it has a purpose that should evolve as the code does. The goal of the function I want help with is to set every location in the array to EMPTY.
My code attempt.
Code:
void FIARClearBoard (FIARBoard* board)
{
for (int x=0; x<FIARCOLUMNS; x++)
{
for (int y=0; y<FIARROWS; y++)
{
board.locations[x][y] = EMPTY;
}
}
}
This method produces the error "Request for member 'locations' in something not a structure or union".
How should I approach this differently?