1.OC冒泡

2.数组遍历几种方式

3.int largenumber = 1000000000;

for(int i=0;i

       Person * p = [Person person];

         [p study];

}

      这段代码有什么问题,应该怎么去改?为什么?

4.(1)请完成声明一个返回值是bool类型,并且带两个字符串对象的BLOCK类型变量;

   (2)为BLOCK类型变量赋值,是该变量具有判断两个字符串对象是否相等的功能;并使用该BLOCK变量测试两个字符串@“Abc”,@“abc”是否相等

5.简述内存管理的原则


新建一个Bubble类

Bubble.h

#import 
@interface Bubble : NSObject
//冒泡排序
- (void)bubbleArray:(NSMutableArray *)array;
@end

Bubble.m

#import "Bubble.h"
@implementation Bubble
- (void)bubbleArray:(NSMutableArray *)array
{
    NSInteger count = [array count];
    for (int i = 0; i < count - 1; i++) {
        for (int j = 0; j < count - i - 1; j++) {
            if ([[array objectAtIndex:j] compare:[array objectAtIndex:j + 1] options:64] == 1) {
                [array exchangeObjectAtIndex:j withObjectAtIndex:j + 1];
            }
        }
    }
   
}
@end


main.m


#import 
#import "Bubble.h"
int main(int argc, const char * argv[]) {
    @autoreleasepool {
        //1.OC冒泡排序
        NSMutableArray *array = [NSMutableArray arrayWithObjects:@"12",@"34", @"35", @"70", @"85", @"9", nil];
        Bubble *arr = [[Bubble alloc] init];
        [arr bubbleArray:array];
        NSLog(@"%@", array);
        
        //2.数组遍历几种方式
        NSArray *array1 = [NSArray arrayWithObjects:@"12",@"34", @"35", @"70", @"85", @"9", nil];
        NSLog(@"数组遍历1");
        for (NSString *i in array1) {
            NSLog(@"%@", i);
        }
        NSLog(@"数组遍历2");
        for (int i = 0; i < [array1 count]; i++) {
            NSLog(@"%@", array1);
        }
        
        //3.
        /*
        int largenumber = 1000000000;
        for(int i=0;i