Board index » cppbuilder » Initializing Multi Dimensioanl Character arrays

Initializing Multi Dimensioanl Character arrays


2003-07-21 01:37:50 PM
cppbuilder2
char[][255] PacManArt =
{
"Art\\PacMan\\PacMan1.bmp"
,"Art\\PacMan\\PacMan2.bmp"
,"Art\\PacMan\\PacMan3.bmp"
,"Art\\PacMan\\PacMan4.bmp"
,"Art\\PacMan\\PacMan5.bmp"
,"Art\\PacMan\\PacMan6.bmp"
};
Whats wrong with this...How do I initiaualze an array of strings?
 
 

Re:Initializing Multi Dimensioanl Character arrays

"Junk Mail" < XXXX@XXXXX.COM >wrote in message
Quote
Whats wrong with this...How do I initiaualze an array of strings?
You need to place the brackets after the array name, not in front of it.
Alternatively, since you are initializing the array at the time of its
declaration, you could do away with the second size value altogether, ie:
char* PacManArt[] = {
"Art\\PacMan\\PacMan1.bmp",
"Art\\PacMan\\PacMan2.bmp",
"Art\\PacMan\\PacMan3.bmp",
"Art\\PacMan\\PacMan4.bmp",
"Art\\PacMan\\PacMan5.bmp",
"Art\\PacMan\\PacMan6.bmp"
};
Gambit