I am trying to make a 2d array in objective-c and I don't really want to use NSArray
because I'm using int and the code would annoying: {[array objectAtIndex:x] objectAtIndex:y]
, not to mention I would have to convert the numbers back from NSNumber
... Seems like a lot of extra work.
Can't I do the following?
// .h file
int aTiles[10][2];
// .m file
aTiles = {
{ 0, 0}, // 0
{ 0, 1}, // 1
{ 1, 5}, // 2
{ 0, 0}, // 3
{ 0, 0}, // 4
{ 0, 0}, // 5
};
it works together in the same line (int a[x][x] = {...};
), but I need the array to be public so I can access it from any function.
The second line says expecting semicolon.
Thanks