Frage

I have 7 float values shorted in NSMutableArray, i need to find the shortest value in between them, how do i find that shortest value

War es hilfreich?

Lösung

Maybe something like this will work:

int k = [yourArray objectAtIndex:0];
for (unsigned i = 1; i < [yourArray count]; i++){
    if([yourArray objectAtIndex:i] < k) k = [yourArray objectAtIndex:i];
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top