I need to use malloc to allocate memory to one instance of struct game and store the return pointer in p_game_info for a game.
This is the code for the relevant function in game.c
void play_game()
{
struct game *p_game_info = 0;
struct game *p_game_info = malloc (sizeof (struct game));
}
This is the code for the struct in game.h
struct game
{
char board[3][3];
char playerNames[2][MAX_NAME_LEN];
int status;
boolean finished;
};
In VS I am getting the following error message
error C2374: 'p_game_info': redefinition; multiple initialization
I have been searching online for a similar problem but have been unsuccessful.
Thanks for your help.