XCode/C Multidimensional Array

Discussion in 'Mac Programming' started by dbwrobel, May 11, 2010.

  1. dbwrobel Guest

    Joined:
    May 11, 2010
    #1
    I'm trying to make a multidimensional array and I'm following a sample that I found online and can't seem to get it to work in Xcode. Here is the form I used in the variable declaration:

    double tcoord[3][3] = {
    {
    -70,70,-10.6789
    }
    {
    -61.2525,-70,-23.9652
    }
    {
    28.5760,-23.9126,-19.4531
    }
    };

    I get an error saying "Expected '}' before '{' token"

    Any ideas?
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    There are no commas between the inner arrays.

    -Lee
     
  3. jsurjit123 macrumors newbie

    Joined:
    Mar 7, 2011
    #3
    making a multidimensional array

    Add commas to after every '}' (not for last one).

    double tcoord[3][3] = {
    {
    -70,70,-10.6789
    },
    {
    -61.2525,-70,-23.9652
    },
    {
    28.5760,-23.9126,-19.4531
    }
    };
     

Share This Page