How to find minimum value in NSMutableArray in Objective C
-
14-04-2021 - |
Domanda
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
Soluzione
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];
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow