Clear an int[x][y] array in Objective-C -


i working on iphone game. working fine, correnct way reset array of ints in objective-c? array holds coordinates walls in each level. array set, every time new level loaded - how can "clear" array?

leveldata.h

int wallh[50][2]; int wallv[50][2]; 

leveldata.m

-(void)setlevelone {      // (50, 70)     wallh[0][0] = 50;     wallh[0][1] = 70;      // (50, 90)     wallh[1][0] = 50;     wallh[1][1] = 90;      // , on ...     // same wallv (vertical walls in level) } 

how can "clear" array, it's ready next level? [wallh release] doesn't work - talking c array :/

you can 0 array using memset function (in case know number of elements in array can use "hardcoded" 100 determining size):

memset(wallh, 0, 100*sizeof(wallh[0][0]); 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -