count -1 问题

    NSMutableArray *ar = [[NSMutableArray alloc]init];

    NSLog(@"%d",((int)[ar count]-1)>100?1:0);

    NSLog(@"%d",([ar count]-1)>100?1:0);

还是要记住无符号整型在for循环中,若有可能出现减法情况,一定要先转成有符号整数。

原文地址:https://www.cnblogs.com/iOSJason/p/4456121.html