I have a c style array used in objective c .m file:
Gift gifts[3];
And Gift is a struct defined as this:
typedef struct {
NSString *name;
CCSprite *sprite;
}Gift;
This is how I use the array
for (int i=0; i<3; i++) {
gifts[i].name = [[NSString stringWithFormat:@"Reward%d_%@.png", i+1, location] retain];
gifts[i].sprite = [CCSprite spriteWithSpriteFrameName:gifts[i].name];
CGPoint pos = [[GameConfigure sharedManager] getCoordinateforKey:@"REWARD_ITEM"];
gifts[i].sprite.position = ccp(pos.x+i*238, pos.y);
[rewardLayer addChild:gifts[i].sprite z:1 tag:100+i];
}
How do I manage the memory?
Do I need to free the C array?
gifts" array?