tags:

views:

16

answers:

1

Hi, if i do like,i know its wrong, but can anyone give alternative solution?

for(int i = 0;i<=3;i++)
{
  myclass *obj[i] = [[myclass alloc] init];
}
+2  A: 

It's kinda hard to tell, since you give no indication of what you're trying to do. Here's my best guess:

myclass *obj[4];
for (int i = 0; i < 4; i++) {
    obj[i] = [[myclass alloc] init];
}

(Note also the change to i < 4. Since the end result is to loop four times, not three, it is bad form to say i <= 3.)

Marcelo Cantos