array
has 0 objects, so array.count
is 0, and then (array.count - 1)
is -1
, i < -1
is -1
, why it can get in this for loop?
for (int i=0; i<array.count-1; i++) {
NSLog(@"why it can get in this for loop?");
for (int j=0; j<array.count-i-1; j++) {
NSLog(@"why it can get in this for loop?");
}
}