0

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....

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

no, i have an array that contains numbers that correspond to questions in a text file that get displayed. i want to be able to make lets say a fixed way of displayed these views in an order. if i do array = 1 it will show me the 2nd question so i want to do smthing like array = 1+3 to be able to see the 2nd and 4th questions
sry for the questions but how would i use intvalue?
[[array objectAtIndex:index] intValue];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.