Array trouble

May 22, 2015 at 1:35am
For some reason my program does not want to copy an array to another array.
Here is the function that should be copying it over.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void reshuffle(int player[], int computer[], int playerToss[], int computerToss[])
{
    bool playerDeckEmpty = true;
    for(int x = 0; x < DECK_SIZE; x++)//checks to see if there player needs to be reshuffled
        {
            if(player[x] != 0)
           {
            playerDeckEmpty = false;
            break;
           }
        }
    int playerCardHolder = 0;
    if (playerDeckEmpty == true)//reshuffles player
        {
        int v = 0;
        for(int v = 0; v < DECK_SIZE; v++);
            {
                playerCardHolder = playerToss[v];
                player[v] = playerCardHolder;
                playerToss[v] = 0;
            }
        }
}


The program checks if the array player is empty, and if it is, it should copy what is in playerToss into player. For some reason if i display the array, they all equal zero.
Last edited on May 22, 2015 at 2:01am
May 22, 2015 at 2:04am
I have also figured out now that the second for loop does not run more than once.
May 22, 2015 at 2:23am
Okay, where are you actually "displaying the array"? Outside of the function? That's your problem.
May 22, 2015 at 2:30am
never mind just fixed the problem. Thank you!
May 22, 2015 at 2:31am
What was the problem, post your solution so anyone else having this problem might find the answer here.
Topic archived. No new replies allowed.