Alex Stelea
Alex Stelea

Reputation: 1219

how to add individual elements in an array

i am trying to add individual integers to a certain array my array is in this form array= number +1 how can i make lets say number be a array = 2 +3 +1 where 2 and 3 are two different distinct obhects that should be commutatively added. i hope i am clear. I dont want the numbers to be added so that the aboce equations would equal 0. i want it to be equal to 2 then 3 then 1....

Upvotes: 0

Views: 156

Answers (1)

Matt S.
Matt S.

Reputation: 13753

NSMutableArray????

Do something like this:

int d = 0;
for (d = 0; i <100; i++)
 {
 [array addObject:[[NSString alloc] initWithFormat:@"%d", d]];
 }

or whatever you want it to be

edit:

To add the numbers, just use intvalue

Upvotes: 1

Related Questions