Does anyone know how to create an array of integers in xcode?
How to create an array of integers
(6 posts) (4 voices)-
Posted 1 year ago #
-
int myIntArray[] = {1, 2, 3, 4, 5};Posted 1 year ago # -
and [ array addObject: [ NSNumber numberWithInteger: 3 ]
Posted 1 year ago # -
Ok that helps a lot, not how would I make it a 2d array of integers, so I could store coordinates like this
array[1][0]=1;
array[1][1]=2;
array[2][0]=34;
array[2][1]=32;Posted 1 year ago # -
These questions probably belong more on a beginner's programming forum. This question has nothing to do with cocos at all..
Try something like this...
#define MAX_COLS 2
#define MAX_ROWS 2int array[MAX_COLS][MAX_ROWS];
array[0][0] = 1;
array[0][1] = 2;
array[1][0] = 34;
array[1][1] = 32;Posted 1 year ago # -
Thanks AceHole ;) that worked perfectly.
Posted 1 year ago #
Reply
You must log in to post.