利用NSMutablearry的 insertObject:<#(id)#> atIndex:<#(NSUInteger)#> 对象方法实例:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) { @autoreleasepool { // insert code here... NSLog(@"Hello, World!"); // 将1 2 3 4 5逆序输出 NSArray *array = @[@1,@2,@3,@4,@5];
NSMutableArray *array2 =[NSMutableArray array]; for(id obj in array) { [array2 insertObject:obj atIndex:0]; } NSLog(@"array数组元素为%@",array); NSLog(@"array2数组元素为%@",array2);
} return 0; } 入学测试可能会用到噢
|