Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Im using Visual studio .net 2003 and im working with VC++. This line keeps telling me i have 'too many initializers'
char Deck[2][52] = {"CA","C2","C3","C4","C5","C6","C7", "C8","C9","C0","CJ","CQ","CK",
"DA","D2","D3","D4","D5","D6","D7",
"D8","D9","D0","DJ","DQ","DK",
"HA","H2","H3","H4","H5","H6","H7",
"H8","H9","H0","HJ","HQ","HK",
"SA","S2","S3","S4","S5","S6","S7",
"S8","S9","S0","SJ","SQ","SK"};If I switch [2][52] to [52][2] i get out of bounds errors
What am I doing wrong?

Just loop to initialize:
char Deck[2][52];
char DeckInit[52] = {"CA","C2","C3","C4","C5","C6","C7", "C8","C9","C0","CJ","CQ","CK",
"DA","D2","D3","D4","D5","D6","D7",
"D8","D9","D0","DJ","DQ","DK",
"HA","H2","H3","H4","H5","H6","H7",
"H8","H9","H0","HJ","HQ","HK",
"SA","S2","S3","S4","S5","S6","S7",
"S8","S9","S0","SJ","SQ","SK"};========================
for(int i = 0; i < 1; ++i )
{
for(int j = 0; j < 52; ++j )
{
Deck[i][j]=DeckInit[j];
}
}==================
That should accomplish the initialize, maybe not as pretty, but should work.
--j
This is my signature.

Oops,
first for should read: for(int i = 0; i < 2; ++i )--j
P.S. Another thing I notice is that I don't think those are char values, If I'm not mistaken a char must be a single character like so 'a', 'b', 'c', '1', '2', '3', etc...
This is my signature.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |