title: My program doesn't deal cards correctly after the first round
body: <p>I have a program that has to go until one of the players get 30 points, if I play it only 1 round it works perfectly but when I try to deal the cards again (different cards per round) it deals the last card it gave the round before and the other 2 are the same (sometimes it doesn't even deal them).</p>
  <pre><code>   while (Player1Point != 30 &amp;&amp; Player2Point != 30){
      for (int i = CardCount; i &lt; Count; i++){
          DealCard(Deck, i, &amp;Hand1, &amp;Hand2, Count, j);
          j++;
      }
      Count = Count + 4;
      CardCount = CardCount + 4;
  </code></pre>
  <p>Here's the function DealCard:</p>
  <pre><code>void DealCard(int Deck[CARDS][PLAYERS], int i, int Hand1[NUMBER][SUITS], int Hand2[NUMBER][SUITS], int Count, int j){
  if (i &lt; Count &amp;&amp; j &lt; 3){
      Hand1[j][0] = Deck[i][0];
      Hand1[j][1] = Deck[i][1];
      Hand2[j][0] = Deck[i+3][0];
      Hand2[j][1] = Deck[i+3][1];
  }
  </code></pre>
  <p>}</p>
  <p>The arrays I use for the cards:</p>
  <pre><code>char* suit[SUITS] = {&quot;Espada&quot;, &quot;Oro&quot;, &quot;Copa&quot;, &quot;Basto&quot;};
  char* num[NUMBER] = {&quot;uno&quot;, &quot;dos&quot;, &quot;tres&quot;, &quot;cuatro&quot;, &quot;cinco&quot;, &quot;seis&quot;, &quot;siete&quot;, &quot;diez&quot;, &quot;once&quot;, &quot;doce&quot;};
  </code></pre>
  <p>When i try to deal for the second time it gives me the last card and 2 &quot;uno de Espada&quot; or 2 &quot;uno de (null)&quot;</p>
  <p>EDIT:
  The MRE (still 66 lines)</p>
  <pre><code>#include  &lt;stdio.h&gt;
  #include &lt;time.h&gt;
  #include &lt;string.h&gt;
  #define SUITS 4
  #define NUMBER 10
  #define CARDS 40
  #define PLAYERS 3
  char* suit[SUITS] = {&quot;Espada&quot;, &quot;Oro&quot;, &quot;Copa&quot;, &quot;Basto&quot;};
  char* num[NUMBER] = {&quot;uno&quot;, &quot;dos&quot;, &quot;tres&quot;, &quot;cuatro&quot;, &quot;cinco&quot;, &quot;seis&quot;, &quot;siete&quot;, &quot;diez&quot;, &quot;once&quot;, &quot;doce&quot;};
  int main(){
      int Player2Point = 0, Player1Point = 0, CardCount = 0, j = 0, Count = 3;
      int Deck[CARDS][PLAYERS];
      int Hand1[NUMBER][SUITS];
      int Hand2[NUMBER][SUITS];
      srand(time(0));
      InitDeck(Deck);
      ShuffleDeck(Deck);
      while (Player1Point != 30 &amp;&amp; Player2Point != 30){
          for (int i = CardCount; i &lt; Count; i++){
              DealCard(Deck, i, &amp;Hand1, &amp;Hand2, Count, j);
              j++;
          }
          PrintCard(Hand1, 3);
          Count = Count + 4;
          CardCount = CardCount + 4;
          Player1Point++;
      }
      return 0;
  }
  void InitDeck(int Deck[CARDS][PLAYERS]){
      int suit, num, row;
      row = 0;
      for (suit = 0; suit &lt; 4; suit++){
          for (num = 0; num &lt; 10; num++){
              Deck[row][0] = suit;
              Deck[row][1] = num;
              row++;
          }
      }
  }
  void ShuffleDeck(int Deck[CARDS][PLAYERS]){
      int Src, Dest, i;
      for(i = 0; i &lt; CARDS; i++){
          Src = i;
          Dest = rand()%CARDS;
          SwapCards(Deck, i, Dest);
      }
  }
  void SwapCards(int Deck[CARDS][PLAYERS], int Src, int Dest){
      int Temp;
      Temp = Deck[Dest][0];
      Deck[Dest][0] = Deck[Src][0];
      Deck[Src][0] = Temp;
      Temp = Deck[Dest][1];
      Deck[Dest][1] = Deck[Src][1];
      Deck[Src][1] = Temp;
  }
  void DealCard(int Deck[CARDS][PLAYERS], int i, int Hand1[NUMBER][SUITS], int Hand2[NUMBER][SUITS], int Count, int j){
      if (i &lt; Count &amp;&amp; j &lt; 3){
          Hand1[j][0] = Deck[i][0];
          Hand1[j][1] = Deck[i][1];
          Hand2[j][0] = Deck[i+3][0];
          Hand2[j][1] = Deck[i+3][1];
      }
  }
  void PrintCard(int Hand1[NUMBER][SUITS], int size){
      printf(&quot;Your cards: \n&quot;);
      int psuit, pnum;
      for (int i = 0; i &lt; size; i++){
          psuit = Hand1[i][0];
          pnum = Hand1[i][1];
          printf(&quot;Card: %s de %s\n&quot;, num[pnum], suit[psuit]);
      }
      printf(&quot;\n&quot;);
  }
  </code></pre>