Search

Blackjack game - array has 0s in first 24 elements immediately after initialising with values from 1 to 13
EDIT: Literally 1 second after I pressed the post button I got an idea and thats what it was. Why does that always happen? xD
The solution was that my player_hand[] and dealer_hand[] arrays had a size of DECK_SIZE / 2, but I was initialising them to 0 from within the for loop where I was initialising the deck[] array (which has a size of DECK_SIZE), so the last 24 0s of one of those where overflowing into deck[]...
Hello everyone!
I am trying to make a simple blackjack (21) game in C, to practice some pointer stuff, and I am running into an issue with the function that initialises all my arrays. The way I am going about setting everything up, I have an integer array for a standard deck of 52 cards (values from 1 to 13, each 4 times), an integer array for the shuffled deck, and 2 more arrays for the player and dealer hands (irrelevant at this point as they are not used yet).
My issue is that after successfully initialising the deck array (the non-shuffled one) and outputting the va