1

I have this array with 10 different numbers:

int number[9];

It gets filled by random function:

for(i=0; i<10; i++)
   number[i] = arc4random() % 100;

Every number can only be taken once.

Now my problem - I want to sort them by value like this:

number[0] == 2
number[1] == 5
number[2] == 16
number[3] == 22
number[4] == 31
number[5] == 43
number[6] == 66
number[7] == 67
number[8] == 87
number[9] == 93

How to do this?

Sorry guys, I am using Xcode. I need a NSArray. So I need to start from beginning:

NSArray Zahl[9];  ????????
3
  • This is a C question. If it were an Objective-C question, we'd have an NSArray full of NSNumber objects. Commented Jun 15, 2014 at 15:22
  • 1
    you don´t have an Array with 10 numbers, you have an Array with 9 numbers Commented Jun 15, 2014 at 15:37
  • Sorry guys, I am using Xcode. I need a NSArray Commented Jun 15, 2014 at 15:43

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.