Announcement

Collapse
No announcement yet.

Array filling problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Array filling problem

    I'm sorry admins if im not supposed to do this but the other forum I usually go to is messing up. Anyway my question is for Java not unreal script, but I figured sence they were both were essentially the same thing there might have been some old java pros that started using this at some point. Here is my question:

    I declared this array but i am having trouble actually filling it.

    Code:
        int WINNING_ROWS[][] = new int[8][3];
    I tried typing this
    Code:
    WINNING_ROWS[][] = {       {0,1,2},
                               {3,4,5},
                               {6,7,8},
                               {0,3,6},
                               {1,4,7},
                               {2,5,8},
                               {0,4,8},
                               {2,4,6}};
    but it says <identifier> expected
    when I try and fix it by adding the int

    Code:
    int WINNING_ROWS[][] = {   {0,1,2},
                               {3,4,5},
                               {6,7,8},
                               {0,3,6},
                               {1,4,7},
                               {2,5,8},
                               {0,4,8},
                               {2,4,6}};
    It says WINNING_ROWS already defined. I don't know what to do and I would really appreciate it if sombody helped.

    #2
    Re: Array filling problem

    try:
    Code:
        int WINNING_ROWS[][] = { {0,1,2}
                                ,{3,4,5}
                                ,{6,7,8}
                                ,{0,3,6}
                                ,{1,4,7}
                                ,{2,5,8}
                                ,{0,4,8}
                                ,{2,4,6} };

    Comment


      #3
      I'm an idiot I didn't try to take out the initzalizing statement. I'm sorry I'm filling space in the forum, it won't happen again:noob:

      Comment

      Working...
      X