关于NSArray基础
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
//1、快速创建数组 @[]
NSArray *week=@[@"mon",@"tue",@"wed",@"thu",@"fri",@"sat",@"sun"];
NSLog(@"%@",week);
//2、创建空的数组
NSArray *arr=[[NSArray alloc]init];
NSArray *arr1=[NSArray array];//Q
//3、动态创建数组
NSArray *arr2=[NSArray arrayWithObjects:@"apple",@"pear",@"banana",nil];//注意nil
NSLog(@"%@",arr2);
//4、数组复制
NSArray *arr4=[NSArray arrayWithArray:week];
NSLog(@"%@",arr4);
//5、获取数组中元素的个数
NSInteger count=[arr4 count];
NSLog(@"%ld",count);
//
}
return 0;
}