Objective-C: How to find the highest value in an array without sorting?
<p>Im working on an assignment in which I have to find the highest value in an array using a for loop, and without sorting it. I feel like what I have so far is close to being correct but not quite there. Below is an example of the code I have so far.</p>

<pre><code>NSArray *unsortedArray = @[ @2, @44, @11, @99, @35 ];


for (int i = 0; i &lt; 4 ; i++) {
    id number = [unsortedArray objectAtIndex:i];
    id largestNumber = 0;
    if (largestNumber &lt; number) {
        largestNumber = number;


        NSLog(@"%@ is the largest number", largestNumber );

  return 0;
    }

}
</code></pre>

<p>Now this is only returning the first value in the area then the loop is stopping, am I assigning the wrong values to largestNumber and number? Very new to code, so I would appreciate and feedback and examples.</p>

<p>Thanks!</p>