I am trying to create a deck of cards in drawPile when newGame is called (with specific cards given as parameters)
I have 4 linked lists to store cards (drawPile,discardPile,player1's hand, and player2's hand)
My _game struct would store the state of my game at a given time (e.g. the cards in drawPile, discardPile, and player1,2's hands)
I am having trouble trying to understand how I should go about using drawPile linked list inside struct _game. How should I allocation memory for drawPile,discardPile..etc when _game is created? As I believe what I currently have in newGame is totally wrong.
Any advice or tips would be greatly appreciated.
typedef enum {RED,BLACK} color;
typedef enum {HEARTS,DIAMONDS,CLUBS,SPADES} suit;
typedef enum {ONE,TWO,THREE,FOUR} value;
typedef struct drawPile{
    enum color color;
    enum suit suit;
    enum value value;
    struct drawPile *next;
}*drawPile; 
I'm a bit confused what is the difference between putting * before drawPile?
typedef struct discardPile{
    enum color color;
    enum suit suit;
    enum value value;
    struct discardPile *next;
};
typedef struct player1Hand{
    enum color color;
    enum suit suit;
    enum value value;
    struct player1Hand *next;
};
typedef struct player2Hand{
    enum color color;
    enum suit suit;
    enum value value;
    struct player2Hand *next;
};
typedef struct _game{
    drawPile game_drawPile;
    discardPile game_discardPile;
    player1Hand game_player1Hand;
    player2Hand game_player2Hand;
}Game;
Game newGame(int deckSize, value values[], color colors[], suit suits[]){
    Game nGame;
    for(int i = 0; i < deckSize; i++){
        nGame->drawPile.value = value[i];
        nGame->drawPile.color = colors[i];
        nGame->drawPile.suit = suits[i];
    }
}
below is an example main function of how the newGame function is going to run with only 4 cards.
int main (void){
     init_deck();
}
static void init_deck(void){
    int deck_size = 4;
    value values[] = {ONE, TWO, THREE, FOUR};
    color colors[] = {RED, BLACK, RED, BLACK};
    suit suits[] = {HEARTS, DIAMONDS, CLUBS, SPADES};
    Game game = newGame(deck_size, values, colors, suits);
 }
I have only pasted segments of my code, please tell me if you need more information.
 
     
    