I'm working on a school project right now and i need to define two structs as addresses, like the code below shows :
typedef struct board_t* board;
/**
* @brief Pointer to the structure that holds the game.
*/
typedef struct piece_t* piece;
/**
* @brief Pointer to the structure that holds a piece
*/
and if i let it like it, it compiles. However, as soon as I try replacing the semicolon by a bracket to define the struct, I get a compilation error. Here's the code and the error :
typedef struct piece_t* piece{
/**
* @brief Pointer to the structure that holds a piece
*/
enum shape p_shape;
enum size p_size;
enum color p_color;
enum top p_top;
enum players author;
};
typedef struct board_t* board{
/**
* @brief Pointer to the structure that holds the game.
*/
piece array[4][4];
}
And the error :
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
53 | typedef struct board_t* board{
What i need to do is create a board filled with pieces that i can edit inside functions. Can anyone help me?