Element printed shows unexpected value : <p>This is my code. It calls a few functions but nothing that is related to the issue.</p>

<pre><code>int main()
{



    srand((unsigned int)time(NULL)); //initializing srand

    struct card *deckAr = createDeck(); //creating the struct card deck array

    for (int i = 0; i &lt; 100000; i++)
    {
        shuffleDeck(deckAr);
    }



        struct card *player1hand = (struct card*)malloc(sizeof(player1hand));
        struct card *player2hand = (struct card*)malloc(sizeof(player2hand));
        struct card *househand = (struct card*)malloc(sizeof(househand));

        player1hand = (struct card*)realloc(player1hand, sizeof(player1hand) * 2);
        player1hand[0] = deckAr[0];
        player1hand[1] = deckAr[1];

        printf("Card 1 %s of %s\n\n", valueName(player1hand[0].suit), suitName(player1hand[0].suit));
        printf("Card 2 %s of %s\n\n", valueName(player1hand[1].suit), suitName(player1hand[1].suit));
        printf("%s of %s\n", valueName(deckAr[0].value), suitName(deckAr[0].suit));


    return 0;
}
</code></pre>

<p>Output:</p>

<pre><code>Card 1 Three of Hearts

Card 2 Three of Hearts

Ten of Hearts
</code></pre>

<p>Since nothing is manipulating deckAr, shouldn't deckAr[0] be the same as player1hand[0]?</p>
