I\'m fairly new to C++ and don\'t quite understand function parameters with pointers and references. I have an array of Cards that I want to shuffle using the Fisher-Yates
It looks that your problem does not come from the code posted, which looks fine at a first glance, but from the code around it.
What about using a standard container of cards ? You must fill it, print it first to see if it's ok, shuffle, and then print it again.
#include
std::vector deck; // Empty for now. Must be filled with cards.
void shuffle (std::vector & deck)
{
int deckSize = 24;
while (deckSize > 1)
{
long int k = lrand48();
k = k %24;
deckSize--;
Card temp = deck[deckSize];
deck[deckSize] = deck[k];
deck[k] = temp;
}
}