strange array values

Hey I'm trying to use a 52 array to create a deck of cards. for each place in the array I'm assigning an int value which will correspond to a certain card.
100’s digit designate the suit (Hearts, Diamonds, Clubs, Spades), and the tens and ones digit designating the Rank (Ace, Two, Three, Four, … Jack, Queen, King).


For example:

101 = Ace of Hearts
102 = Two of Hearts
...
112 = Queen of Hearts
113 = King of Hearts

201 = Ace of Diamonds
202 = Two of Diamonds.
...
213 = King of Diamonds

301 = Ace of Clubs
302 = 2 of Clubs
..
313 = King of Clubs

401 = Ace of Spades
...
413 = King of Spades

So starting from place 0 in the array I assign the first value and so forth for the whole array. But when I created this function to assign the values I got back -858993460 as the value for each place in the array. I cant quite figure out what went wrong with my function or if their is an easier way to assign the values.

Any ideas or help is greatly appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  void initializeDeck( int deck[])
{
	for(int a = 0; a < 12; a++)
   {
	   deck[a] = 101+a;
   }

	for(int b = 13; b < 25; b++)
   {
	   deck[b] = 188+b;
   }

	for(int c = 26; c < 38; c++)
   {
	   deck[c] = 285+c;
   }

	for(int d = 39; d < 51; d++)
   {
	   deck[d] = 362+d;
   }
}
Have you check the Deck[] value before its return ?
I'm not quite sure what you mean, I'm not returning anything I'm just trying to populate the array with the specific values. I rechecked the values and its actually working except every 13th card is showing that weird value.
Try to use <=
I think your problem is that 13th value is not assign yet, ex the first loop end at 101+11 because the condition is a<12
You were right, it's working correctly now. Thanks a lot for the help. I don't know why I didn't catch that but it's much appreciated.
Topic archived. No new replies allowed.