I have a problem that I can not understand
NSArray *emptyArr = @[];
for (int i=0; i < ([emptyArr count]-1) ; i++) {
NSLog(@\"Did run for1\");
}
The value returned by [emptyArr count] is unsigned integer. In the first case, [emptyArr count]-1 is 0-1 represented in 2's compliment, which is a huge number. So it prints the log many times.
In the second case, [emptyArr count]-1 -> You are casting the result of this to int. 0-1 -> -1 signed int. Hence does not print.