The code was written in C by someone else. Its not my homework
I just dont know how the functions split and merge deck work.
In splitDeck there has to code to traverse the list, that is, get to the midpoint in the list.
Once i am 26 in the list, then I am at the *end* of one half, and the 27th is the *start* of the second half.
Since a pointer to the list is the first element of it, store the 27th as a new list.
Also remember that the last element of a list should have next == NULL and the first should have prev == NULL.
The trouble is how to do it
If you look in the splitDeck() function, he writes
d[0]->prev = d[25];
d[25]->next = d[0];
//Trying to get the first half
I have done a little coding in my splitDeck function
struct deck *splitDeck(struct deck *deck)
{
struct deck *deck2;
enum suiteType s;
enum valueName v;
..
for(s = Heart; s <= Club; s++)
{
for(v = Ace; v < Two; v++)
{
....
}
}
return ..&&..;
}
gbilios
|