About Store Forum Documentation Contact



Post Reply 
2D Array
Author Message
runewake2 Offline
Member

Post: #1
2D Array
So, I'm attempting to initialize a counter in my game that is a 2D Array. It is supposed to set each variable to 0. But it doesn't.

PHP Code:
int[,]  PlayerToken  = new int[6,4];
        for(
int i=0;6;i++){
            for(
int n=0;4;n++){
                
PlayerToken[i,n]=0;
            }
        } 

Why am I getting all sorts of errors from this?
06-13-2011 10:22 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: 2D Array
http://www.cplusplus.com/doc/tutorial/arrays Scroll down to Multidimensional Arrays
06-13-2011 10:41 PM
Find all posts by this user Quote this message in a reply
runewake2 Offline
Member

Post: #3
RE: 2D Array
I feel really stupid right now. I was trying to use this code, all at once, during the class definition (I think that's what it is called). When the for statements where placed in the Initialization function everything worked fine. I won't be doing that again.
06-13-2011 11:35 PM
Find all posts by this user Quote this message in a reply
Post Reply